<!DOCTYPE HTML><html><head> <meta charset="utf-8"> <title></title> <style type="text/css"> body,h1,input,button,select{ font-size: 30px; } </style></head><body> <h1>员工查询</h1> <label>输入员工编号:</label> <input type="text" id="keyword"><br> <button id="search">查询</button><br> <p id="searchResult"></p><br> <h1>员工创建</h1> <label>员工姓名:</label> <input type="text" id="staffName"><br> <label>员工编号:</label> <input type="text" id="staffNumber"><br> <label>员工性别:</label> <select id="staffSex"> <option>男</option> <option>女</option> </select><br> <label>员工职位:</label> <input type="text" id="staffJob"><br> <button id="save">保存</button><br> <p id="createResult"></p> <script type="text/javascript"> document.getElementById("search").onclick=function(){ var request=new XMLHttpRequest(); request.open("GET","server.php?number="+document.getElementById("keyword").value); request.send(); request.onreadystatechange=function(){ if(request.readyState===4 && request.status===200){ alert("查询成功!"); document.getElementById("searchResult").innerHTML=request.responseText; }else{ alert("发生错误:"+request.status); } } }// document.getElementById("save").onclick=function(){// var request=new XMLHttpRequest();// request.open("POST","server.php");// var data="name="+document.getElementById("")// request.send(data);// } </script></body> </html>
添加回答
举报
0/150
提交
取消