一直揭示:xmlhttp is not defined
Jun 13, 2016 pm 01:10 PM
form
quot
一直提示:xmlhttp is not defined
描述:在做一个公共聊天室的页面,在用户提交发言后,在公共讨论区显示发言。
talk.php文件中的提交代码:
其中还包含了:
js函数tk就是在main.js中定义的,代码为:
function tk(form,maxtm){
if(form.cont.value==""){
alert("发言不允许为空!");
form.cont.focus();
return false
}
face = form.face.value;
color = form.color.value;
obt = form.obt.value;
cont = form.cont.value;
var url = "talk_chk.php?action=send&face="+face+"&color="+color+"&obt="+obt+"&cont="+cont;
xmlhttp.open("Get",url,true);
xmlhttp.onreadystatechange = callback;
xmlhttp.send(null);
form.cont.value="";
form.cont.focus();
refrsh(maxtm);
return false;
}
但是提交发言后,提示: xmlhttp is not defined !! 弄了一晚上了,跪求!!!!!!
xmlhttprequest.js中的代码:
if(window.ActiveXObject){
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpReuqest){
xmlhttp = new XMLHttpRequest();
}
------解决方案--------------------
else if( window.XMLHttpReuqest )
这里错了, 是 XMLHttpRequest
所以这才导致没有进入任何一个分支,自然xmlhttp未定义
------解决方案--------------------
IE下的有几个不同版本 找齐咯
------解决方案--------------------
别用原生的xmlhttp,用类库吧,jquery,mootools皆可
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot tools Tags

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

BinaryX is renamed FORM again, and the FOUR it gives to the community is about to soar?

Can there be multiple forms in html5?

What is the tag that defines the form in html5

Comprehensively organize elements related to form forms!

What should I do if the form cannot be submitted to php?

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题
