js中的代码:
// JavaScript Documentvar xmlHttp;function S_xmlhttprequest(){ if(window.ActiveXObject){ xmlHttp = new ActiveXObject('Microsoft.XMLHTTP'); }else if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } }function checktea(){ S_xmlhttprequest(); if(xmlHttp.readyState==4 || xmlHttp.readyState==0){ teaid = document.getElementById("tea_id").value; teapwd = document.getElementById("tea_pwd").value; teaname = document.getElementById("tea_name").value; teasex = document.getElementById("tea_sex").value; teaxuey = document.getElementById("tea_xuey").value; teakecheng = document.getElementById("tea_kecheng").value; teabeizhu = document.getElementById("tea_beizhu").value;xmlHttp.open("GET","tea_add_ok.php?tea_id="+teaid+"& tea_pwd="+teapwd+"& tea_name="+teaname+"& tea_sex="+teasex+"& tea_xuey="+teaxuey+"& tea_kecheng="+teakecheng+"& tea_beizhu="+teabeizhu,true); xmlHttp.onreadystatechange=handleServerResponse; xmlHttp.send(null);} }function .getElementById("tea_beizhu").value=""; }function handleServerResponse(){ //在处理结束时进入下一步 if(xmlHttp.readystate==4){ //状态为200表示处理成功结束 if(xmlHttp.status==200){ //获取服务器端发来的XML信息 xmlResponse=xmlHttp.responseXML; //获取XML中的文档对象(根对象) xmlDocumentElement=xmlResponse.documentElement; //获取第一个文档子元素的文本信息 helloMessage=xmlDocumentElement.firstChild.data; //使用从服务器端发来的消息更新客户端显示的内容 document.getElementById("divmessage").innerHTML='<i>'+helloMessage+'</i>'; //重新开始 }else{ //如果HTTP的状态不是200表示发生错误 alert("There was a problem accessing the server:"+xmlHttp.statusText); } }}admin_tea_add,php中代码:<tr> <td width="70" height="40" align="right">姓名:</td> <td width="150" height="40" align="left"> <input type="text" name="tea_name" id="tea_name" /> </td> <td width="70" height="40" align="right">性别:</td> </tr><input id="tea_submit" type="button" value="提交并保存" onclick="checktea()" style="background:url(images/webbgbt.png);" />tea_add_pk中代码:<?php //创建一个XML格式输出header('Content-Type: text/xml');//创建XML头echo '<?xml version="1.0" encoding="utf-8" standalone="yes" ?>';echo '<response>';$teanamet = $_GET['tea_name'];$teasext = $_GET['tea_sex'];echo "#".$teanamet = $_GET['tea_name'];echo "#的信息已经成功录入!";//}else{echo "录入过程出现未知错误";}echo '</response>';?>
这么乱 谁会吊你?追问
额,最后的5个财富值我都来问这个问题了你说我是诚心的吗?我打的时候不是这样的发了就这样了、也没法改啊亲....