Skip to content

Commit

Permalink
124
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Feb 16, 2017
1 parent ac0feb1 commit a9c7f18
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
17 changes: 17 additions & 0 deletions practice/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>practice</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
</natures>
</projectDescription>
49 changes: 49 additions & 0 deletions practice/1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
div{
width:200px;
height:200px;
border:1px solid #000;
}

</style>
<body>
<div></div>
<input type="button" value="按钮"/>
<input type="button" value="暂停" class="two"/>
<script>
var input=document.querySelector(("input"));
var end=document.querySelector((".two"));

var div=document.querySelector("div");
input.onclick=function(){
var obj=new XMLHttpRequest();
obj.onloadend=function(){
var stu=obj.responseXML.getElementsByTagName("stu");
var str="<table>";
str+="<tr><th>"+"name"+"</th><th>"+"age"+"</th><th>"+"sex"+"</th></tr>";
for (var i=0;i<stu.length;i++){
str+="<tr><td>"+stu[i].getElementsByTagName('name')[0].innerHTML+"</td><td>"+stu[i].getElementsByTagName('age')[0].innerHTML+"</td><td>"+stu[i].getElementsByTagName('sex')[0].innerHTML+"</td></tr>"
//这里的stu[i].getElementsByTagName('sex')[0].innerHTML是变量一定不能加''号,如同他下面的例子。
}
str+="</table>";
div.innerHTML=str;
}
end.onclick=function(){
obj.abort()
}
obj.open("post","1.xml");
obj.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
obj.send("name=zhangsan&age=14")
}
// var a="sdflsdl";
// console.log("a")
</script>
<form action="" enctype="application/x-www-form-urlencoded"></form>
</body>
</html>
5 changes: 5 additions & 0 deletions practice/1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

<?php
// sleep(2);
echo $_POST["name"];
?>
13 changes: 13 additions & 0 deletions practice/1.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<stu>
<name>秦鹏森</name>
<age>11</age>
<sex>男</sex>
</stu>
<stu>
<name>秦鹏森</name>
<age>11</age>
<sex>男</sex>
</stu>
</root>

0 comments on commit a9c7f18

Please sign in to comment.