Heim  >  Artikel  >  Backend-Entwicklung  >  麻烦帮小弟我看看个JAVASCRIPT的提交

麻烦帮小弟我看看个JAVASCRIPT的提交

WBOY
WBOYOriginal
2016-06-13 10:15:10883Durchsuche

麻烦帮我看看个JAVASCRIPT的提交
我主要要实现提交表单后仍然保留表单的数据,买了本《浅入深学 php》,里面 395页的代码有个 handle_f, 我照抄,但是我的PHP里没执行,为什么?我这里稍为改了一下,但是PHP 没执行handle_f,如果执行会弹出一个对话框 'hello world'






------解决方案--------------------
在什么浏览器下运行的,代码中创建XMLHttpRequest对象的方法只适用于IE5、6浏览器,兼容各浏览器的写法:

JScript code
function create_obj() {    var xmlHttp;    if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();    else if (window.ActiveXObject) xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");    return xmlHttp;}<br><font color="#e78608">------解决方案--------------------</font><br>创建xmlHttp 对象有问题吧。 你那种是ie下的。非ie下的没加进去。改为下面这样试试:<br>xmlHttp=window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); <br><br><font color="#e78608">------解决方案--------------------</font><br>
探讨
我主要要实现提交表单后仍然保留表单的数据
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn