Home Backend Development PHP Tutorial 一直揭示:xmlhttp is not defined

一直揭示: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 尊渡假赌尊渡假赌尊渡假赌

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 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决

BinaryX is renamed FORM again, and the FOUR it gives to the community is about to soar? BinaryX is renamed FORM again, and the FOUR it gives to the community is about to soar? Mar 04, 2025 pm 12:00 PM

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

Can there be multiple forms in html5? Can there be multiple forms in html5? Aug 01, 2022 pm 05:28 PM

Can there be multiple forms in html5?

What is the tag that defines the form in html5 What is the tag that defines the form in html5 Jul 26, 2022 pm 04:26 PM

What is the tag that defines the form in html5

Comprehensively organize elements related to form forms! Comprehensively organize elements related to form forms! Aug 05, 2022 am 11:45 AM

Comprehensively organize elements related to form forms!

What should I do if the form cannot be submitted to php? What should I do if the form cannot be submitted to php? Dec 01, 2022 am 09:08 AM

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

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

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

php记录搜索引擎蜘蛛爬行记录代码 php记录搜索引擎蜘蛛爬行记录代码 Jun 13, 2016 am 10:08 AM

php记录搜索引擎蜘蛛爬行记录代码

See all articles