简单的PHP+MySQL+AJAX留言板实例

上传者: Relyn | 上传时间: 2022-05-06 12:38:47 | 文件大小: 79KB | 文件类型: RAR
对初学AJAX的同学会有帮助的。 ----------ajax.js--------------- var request = false; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } } if (!request) alert("Error initializing XMLHttpRequest!"); function getCustomerInfo() { document.getElementById("output").innerHTML = "Loading..."; document.getElementById("submit").disabled = true; var name = document.getElementById("name").value; var text = document.getElementById("text").value; var key = document.getElementById("key").value; var answer = document.getElementById("answer").value; var poststr = "name="+name+"&text="+text+"&key="+key+"&answer="+answer; var url = "doit.php"; request.open("POST", url, true); request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); request.send(poststr); request.onreadystatechange = updatePage; } function updatePage() { if (request.readyState == 4) if (request.status == 200) document.getElementById("output").innerHTML = request.responseText; else if (request.status == 404) alert("目标地址不存在"); else alert("警告: 错误代码 " + request.status); } function getInfo() { document.getElementById("output1").innerHTML = "Loading..."; var url = "show.php"; var d = new Date().getTime(); request.open("GET", url+"?d="+d.toString(), true); request.onreadystatechange = updatePage1; request.send(); } function updatePage1() { if (request.readyState == 4) if (request.status == 200) document.getElementById("output1").innerHTML = request.responseText; else if (request.status == 404) alert("目标地址不存在"); else alert("警告: 错误代码 " + request.status); }

文件下载

资源详情

[{"title":"( 13 个子文件 79KB ) 简单的PHP+MySQL+AJAX留言板实例","children":[{"title":"guestbook","children":[{"title":"doit.php <span style='color:#111;'> 670B </span>","children":null,"spread":false},{"title":"show.php <span style='color:#111;'> 515B </span>","children":null,"spread":false},{"title":"config.inc.php <span style='color:#111;'> 88B </span>","children":null,"spread":false},{"title":"index.php <span style='color:#111;'> 1.78KB </span>","children":null,"spread":false},{"title":"0.swf <span style='color:#111;'> 1.89KB </span>","children":null,"spread":false},{"title":"1.swf <span style='color:#111;'> 69.04KB </span>","children":null,"spread":false},{"title":"ajax.js <span style='color:#111;'> 1.84KB </span>","children":null,"spread":false},{"title":"Thumbs.db <span style='color:#111;'> 5.50KB </span>","children":null,"spread":false},{"title":"index.htm <span style='color:#111;'> 1.32KB </span>","children":null,"spread":false},{"title":"btbg.gif <span style='color:#111;'> 871B </span>","children":null,"spread":false},{"title":"MySQL文件","children":[{"title":"guestbook.sql <span style='color:#111;'> 633B </span>","children":null,"spread":false}],"spread":true},{"title":"style.css <span style='color:#111;'> 3.75KB </span>","children":null,"spread":false},{"title":"mysql.php <span style='color:#111;'> 1.73KB </span>","children":null,"spread":false}],"spread":false}],"spread":true}]

评论信息

  • hddsh :
    新手学习不错,谢谢!
    2014-05-22
  • zhangcong0022 :
    项目设计得挺合理,可以使用
    2014-01-07
  • killeryei :
    还不错,可以学习ajax
    2013-10-11
  • dalaogeguluo :
    项目设计得挺合理,可以运行
    2012-07-12
  • nicholas_lpf :
    还行,可以使用
    2011-10-08

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明