<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="username" value ="传智播客5周年_1" id ="tid" >
<input type ="button" name ="ok" value ="保存1" />
</form >
</body >
<script language ="JavaScript" >
var tidValue = document.getElementById("tid" ).value;
alert(tidValue);
var tidType = document.getElementById("tid" ).type;
alert(tidType);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="传智播客5周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_3" id ="tid_3" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_4" id ="tid_4" onchange ="change1()" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_5" id ="tid_5" onchange ="change2()" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_6" id ="tid_6" onchange ="change3()" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
</body >
<script language ="JavaScript" >
var tnameElements = document.getElementsByName("tname" );
alert(tnameElements.length);
for (var i = 0 ; i<tnameElements.length; i++){
var tnameValue = tnameElements[i].value;
alert(tnameValue);
}
for (var i = 0 ; i<tnameElements.length; i++){
var tnameElement = tnameElements[i];
tnameElement.onchange = function () {
alert(this .value);
}
}
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="传智播客5周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_3" id ="tid_3" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
<select name ="edu" id ="edu" >
<option value ="博士" > 博士^^^^^</option >
<option value ="硕士" > 硕士^^^^^</option >
<option value ="本科" selected ="selected" > 本科^^^^^</option >
<option value ="幼儿园" > 幼儿园^^^^^</option >
</select >
<select name ="job" id ="job" >
<option value ="美容" > 美容^^^^^</option >
<option value ="IT" > IT^^^^^</option >
<option value ="程序员" > 程序员^^^^^</option >
<option value ="建筑师" > 建筑师^^^^^</option >
</select >
</body >
<script language ="JavaScript" >
var inputElements = document.getElementsByTagName("input" );
alert(inputElements);
alert(inputElements.length);
for (var i = 0 ; i<inputElements.length; i++){
alert(inputElements[i].value);
}
for (var i = 0 ; i<inputElements.length; i++){
var inputElement = inputElements[i];
if (inputElement.type == "text" ){
alert(inputElement.value);
}
}
var eduElement = document.getElementById("edu" );
var optionElements = eduElement.getElementsByTagName("option" );
for (var i = 0 ; i<optionElements.length; i++){
alert(optionElements[i].value);
}
var eduElement = document.getElementById("edu" );
alert(eduElement.value);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="传智播客5周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_3" id ="tid_3" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
<select name ="edu" id ="edu" >
<option value ="博士" > 博士^^^^^</option >
<option value ="硕士" > 硕士^^^^^</option >
<option value ="本科" selected ="selected" > 本科^^^^^</option >
<option value ="幼儿园" > 幼儿园^^^^^</option >
</select >
<select name ="job" id ="job" >
<option value ="美容" > 美容^^^^^</option >
<option value ="IT" > IT^^^^^</option >
<option value ="程序员" > 程序员^^^^^</option >
<option value ="建筑师" > 建筑师^^^^^</option >
</select >
</body >
<script language ="JavaScript" >
var eduElement = document.getElementById("edu" );
alert(eduElement.hasChildNodes);
var tidElement = document.getElementById("tid_1" );
alert(tidElement.hasChildNodes());
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="传智播客5周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_3" id ="tid_3" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
<select name ="edu" id ="edu" >
<option value ="博士" > 博士^^^^^</option >
<option value ="硕士" > 硕士^^^^^</option >
<option value ="本科" selected ="selected" > 本科^^^^^</option >
<option value ="幼儿园" > 幼儿园^^^^^</option >
</select >
<select name ="job" id ="job" >
<option value ="美容" > 美容^^^^^</option >
<option value ="IT" > IT^^^^^</option >
<option value ="程序员" > 程序员^^^^^</option >
<option value ="建筑师" > 建筑师^^^^^</option >
</select >
<p id ="pid" name ="8888" >
明天上课
</p >
</body >
<script language ="JavaScript" >
var tidElement = document.getElementById("tid_1" );
alert(tidElement.nodeName);
alert(tidElement.nodeType);
alert(tidElement.nodeValue);
var pidElement = document.getElementById("pid" );
alert(pidElement.nodeName);
alert(pidElement.nodeType);
alert(pidElement.nodeValue);
var nameElement = pidElement.getAttributeNode("name" );
alert(nameElement.nodeName);
alert(nameElement.nodeType);
alert(nameElement.nodeValue);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="国庆六十周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="国庆六十周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="国庆六十周年_3" id ="tid_3" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
您喜欢的城市:<br >
<ul >
<li id ="bj" value ="beijing" > 北京</li >
<li id ="sh" value ="shanghai" > 上海</li >
<li id ="cq" value ="chongqing" > 重庆</li >
</ul >
您喜欢的游戏:<br >
<ul >
<li id ="fk" value ="fangkong" > 反恐<p > 精英</p > </li >
<li id ="ms" value ="moshou" > 魔兽</li >
<li id ="cq" value ="chuanqi" > 传奇</li >
</ul >
</body >
<script language ="JavaScript" >
document.getElementById("bj" ).onclick = function () {
var bjElement = document.getElementById("bj" );
var fkElement = document.getElementById("fk" );
var parentElement = bjElement.parentNode;
parentElement.replaceChild(fkElement, bjElement);
}
document.getElementById("bj" ).onclick = function () {
var fkElement = document.getElementById("fk" );
var parentElement = this .parentNode;
parentElement.replaceChild(fkElement,this );
}
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<form name ="form1" action ="test.html" method ="post" >
<input type ="text" name ="tname" value ="传智播客5周年_1" id ="tid_1" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_2" id ="tid_2" > <br >
<input type ="text" name ="tname" value ="传智播客5周年_3" id ="tid_3" > <br >
<input type ="button" name ="ok" value ="保存1" />
</form >
您喜欢的城市:<br >
<ul >
<li id ="bj" value ="beijing" > 北京</li >
<li id ="sh" value ="shanghai" > 上海</li >
<li id ="cq" value ="chongqing" > 重庆</li >
</ul >
您喜欢的游戏:<br >
<ul >
<li id ="fk" value ="fangkong" > 反恐</li >
<li id ="ms" value ="moshou" > 魔兽</li >
<li id ="xj" value ="xingji" > 星际争霸</li >
</ul >
</body >
<script language ="JavaScript" >
var xjElement = document.getElementById("xj" );
alert(xjElement.getAttribute("id" ));
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
您喜欢的城市:<br >
<ul >
<li id ="bj" value ="beijing" > 北京</li >
<li id ="sh" value ="shanghai" > 上海</li >
<li id ="cq" value ="chongqing" > 重庆</li >
</ul >
您喜欢的游戏:<br >
<ul >
<li id ="fk" value ="fangkong" > 反恐</li >
<li id ="ms" value ="moshou" > 魔兽</li >
<li id ="xj" value="xingji" > 星际争霸</li >
</ul >
</body >
<script language ="JavaScript" >
var xjElement = document.getElementById("xj" );
xjElement.setAttribute("name" ,"xingjizhengba" );
alert(xjElement.getAttribute("name" ));
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<select name ="edu" id ="edu" >
<option value ="博士" > 博士^^^^^</option >
<option value ="硕士" > 硕士^^^^^</option >
<option value ="本科" > 本科^^^^^</option >
<option value ="幼儿园" > 幼儿园^^^^^</option >
</select >
</body >
<script language ="JavaScript" >
var optionElement = document.createElement("option" );
optionElement.setAttribute("value" ,"大专" );
var textElement = document.createTextNode("大专^^^^^" );
optionElement.appendChild(textElement);
var eduElement = document.getElementById("edu" );
eduElement.appendChild(optionElement);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > insertBefore.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<ul >
<li id ="bj" name ="beijing" > 北京</li >
<li id ="sh" name ="shanghai" > 上海</li >
<li id ="cq" name ="chongqing" > 重庆</li >
</ul >
</body >
<script language ="JavaScript" >
var liElement = document.createElement("li" );
liElement.setAttribute("id" ,"tj" );
liElement.setAttribute("name" ,"tianjin" );
var textElement = document.createTextNode("天津" );
liElement.appendChild(textElement);
var cqElement = document.getElementById("cq" );
var parentElement = cqElement.parentNode;
parentElement.insertBefore(liElement,cqElement);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > insertBefore.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<ul >
<li id ="bj" name ="beijing" > 北京</li >
<li id ="sh" name ="shanghai" > 上海</li >
<li id ="cq" name ="chongqing" > 重庆</li >
</ul >
</body >
<script language ="JavaScript" >
var tjElement = document.createElement("li" );
tjElement.setAttribute("id" ,"tj" );
tjElement.setAttribute("name" ,"tianjin" );
var textElement = document.createTextNode("天津" );
tjElement.appendChild(textElement);
var shElement = document.getElementById("sh" );
var cqElement = shElement.nextSibling;
var parentElement = shElement.parentNode;
parentElement.insertBefore(tjElement,cqElement);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > insertBefore.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<ul id ="city" >
<li id ="bj" name ="beijing" > 北京</li >
<li id ="sh" name ="shanghai" > 上海</li >
<li id ="cq" name ="chongqing" > 重庆</li >
</ul >
</body >
<script language ="JavaScript" >
var bjElement = document.getElementById("bj" );
var parentElement = bjElement.parentNode;
parentElement.removeChild(bjElement);
</script >
</html >
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html >
<head >
<title > form.html</title >
<meta http-equiv ="keywords" content ="keyword1,keyword2,keyword3" >
<meta http-equiv ="description" content ="this is my page" >
<meta http-equiv ="content-type" content ="text/html; charset=UTF-8" >
</head >
<body >
<div id ="city" > </div >
</body >
<script language ="JavaScript" >
document.getElementById("city" ).innerHTML = "<h1>今天</h1>" ;
</script >
</html >