我有一个锚标记,其中我有mouseover
和mouseout
函数。onmouseover with ajax not working
CSS:
.pt #showdata
{
z-index:10;
position:absolute;
left:350px;
top:150px;
display:none;
width:400px;
height:300px;
border:1px solid black;
}
代码:
<div class="title">
rid:<a
onmouseover="showCustomer(' + item.pid + ',' + item.rmid + ')"
onmouseout="hide()">' + item.rid + '</a></div><div id="showdata">
</div>
function hide() {
document.getElementsById("showdata").style.display = "none";
}
当我鼠标移到' + item.rid + '
它应该显示我从数据库内容showdata股利,但但它不会发生。
使用检查元件showcustomer具有价值,但它不显示的style.display =“块”
除了一个以上的参数的查询字符串是正确的吗?
"<?php echo Yii::app()->request->baseUrl;? >/index.php/controller/action/id/"+s1+"&mid/"+s2**
function showCustomer(s1,s2) {
document.getElementsById("showdata").style.display = "block";
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("showdata").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","<?php echo Yii::app()->request->baseUrl;? >/index.php/controller/action/id/"+s1+"&mid/"+s2,true);
xmlhttp.send();
}
但随后从数据库中的数据不会被阿贾克斯获取.....这是不工作....
xmlhttp.open("GET","<?php echo Yii::app()->request->baseUrl;? >/index.php/controller/action/id/"+s1+"&mid/"+s2,true);
谁能告诉我什么是错的代码吗?
难道该请求是异步的,只是当你已经离开尚未出现鼠标远离物品? –
什么是投入到showCustomer()它有说+ + item.pid但希望这被设置为我的部分php代码或js,但如果js它不能设置 –
@Hans atleast div应该显示,也不工作。 ...... – hir