index.php....
<?phpfor (){
echo '<script>var myuin=new Array();</script>';
echo '<script>myuin['.$i.']='.$uin.';</script>';
?>
......
<?php <div id = cr_<?php echo uin; ?>></div>}?>
......这样定义JS数组是正确的,或许有点傻瓜式.以上是index.php与上面的js有关的部份代码
<?phpfor (){
echo '<script>var myuin=new Array();</script>';
echo '<script>myuin['.$i.']='.$uin.';</script>';
?>
......
<?php <div id = cr_<?php echo uin; ?>></div>}?>
......这样定义JS数组是正确的,或许有点傻瓜式.以上是index.php与上面的js有关的部份代码
{
if (locationid == null) return;
var url = "ajax_chatroom.php?uin=" + escape(locationid);
// alert(url);在此加入这句所有显示均正常正确
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = function(){ resultValue(locationid);};
xmlHttp.send(null);
}function resultValue(id)
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
document.getElementById(id).innerHTML = xmlHttp.responseText;
}
}
{
var xmlHttp = false;
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2)
{
xmlHttp = false;
}
} if (!xmlHttp && typeof XMLHttpRequest != 'undefined')
{
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
} for (var i = 0; i < myuin.length; i++)
{
changeselect(myuin[i]);
}function changeselect(locationid)
{
if (locationid == null) return;
var url = "ajax_chatroom.php?uin=" + escape(locationid);
xmlHttp = f_xmlHttp();
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = function(){ resultValue(locationid);};
xmlHttp.send(null);
}function resultValue(locationid)
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
document.getElementById(locationid).innerHTML = xmlHttp.responseText;
}
}</script>
<script language="javascript">function f_xmlHttp()
{
var xmlHttp = false;
try
{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e2)
{
xmlHttp = false;
}
}if (!xmlHttp && typeof XMLHttpRequest != 'undefined')
{
xmlHttp = new XMLHttpRequest();
}
return xmlHttp;
}for (var i = 0; i < myuin.length; i++)
{
changeselect(myuin[i]);
}function changeselect(locationid)
{
if (locationid == null) return;
var url = "ajax_chatroom.php?uin=" + escape(locationid);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = function(){ resultValue(locationid);};
xmlHttp.send(null);
}function resultValue(locationid)
{
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
{
document.getElementById(locationid).innerHTML = xmlHttp.responseText;
}
}</script>
如果你那里还是不行,清一下cache试试