我试图让txtHint
每次通过时都是唯一的或不同的。任何有关创建计数器或增量的帮助都将非常感激。感谢
<script type="text/javascript">
function showCustomer(str)
{
var xmlhttp;
if (str=="")
{
document.getElementById("txtHint").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").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","***.php?q="+str,true);
xmlhttp.send();
}
</script>
答案 0 :(得分:1)
<script type="text/javascript">
var count = 0;
function showCustomer(str) {
count++;
然后将"txtHint"
替换为"txtHint" + count