![](/img/trans.png)
[英]Java script code not working in Internet Explorer while working perfectly fine in Google Chrome
[英]i have created a online typing test page using javascript and ajax. the code is working fine in google chrome firefox, but not in internet explorer
在Internet Explorer中,刷新单词时再次收到相同的响应。 这是在onclick事件中刷新单词列表的功能。
function refresh() {
// divs in which words to be set
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) {
/*
------------
-----------
logic in which words are received from database in a para and then separated and inserted in
div where words are to be displayed.
-----------
-----------
*/
}
xmlhttp.open("GET","getdata.php",true);
xmlhttp.send();
}// refresh
在getdata.php
从数据库中随机选择一个参数,然后在上面的if
块中分隔单词。 整个代码在所有浏览器中均能正常工作(即,接收到随机段落),但是在Internet Explorer中,一次又一次接收到相同的段落。
我完全困惑为什么它不能在IE中工作。 如果有人有想法,请告诉我为什么会这样,需要进行哪些修改。
有关此问题的更多说明,请在chrome中检查此链接http://www.geekzgarage.com/typing-test/ ,然后单击刷新图像。 每次您都会看到随机单词。 但是在IE中,每次刷新后都会出现相同的单词。 注意:此问题可能已在上述链接上解决。
对getdata.php的请求可能是浏览器缓存的。 尝试在URL末尾添加时间戳。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.