function showRole(str,x)
{
if (str=="")
{
document.getElementById("txtHintrole"+x+"").innerHTML="";
return;
}
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("txtHintrole"+x+"").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://localhost/tes/index.php/form/role/"+str,true);
xmlhttp.send();
}
function showUser(str,x)
{
if (str=="")
{
document.getElementById("txtHint"+x+"").innerHTML="";
return;
}
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("txtHint"+x+"").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://localhost/tes/index.php/form/hint/"+str,true);
xmlhttp.send();
}
我可以将这2功能加入1,因为我需要它们两个来显示数据,我不知道如何设置2功能
newcell.childNodes [0] .setAttribute(“onchange”,“showUser(this.value,”xx“);”);
1 回答
我猜你想在
onchange
上调用两个函数 . 试试这个:或者既然你标记了这个jQuery,那就用jQuery方式做吧: