<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>使用Document方法</title>
<style type="text/css">
body{font-size:14px;
     line-height:30px;
     }
input{margin:1px;
      width:90px;
      font-size:12px;
      padding:0;
      }
#node{
    width:100px;
    font-size:24px;
    font-weight:bold;
    float: left;
    }
</style>
<script  type="text/javascript">
function changeLink(){
   document.getElementById("node").innerHTML="搜狐";
}
 
function all_input(){
  var aInput=document.getElementsByTagName("input");
   var sStr="";
  for(var i=0;i<aInput.length;i++){
    sStr+=aInput[i].value+"<br />";
    }
   document.getElementById("s").innerHTML=sStr;
}
     
function s_input(){
  var aInput=document.getElementsByName("season");
  var sStr="";
  for(var i=0;i<aInput.length;i++){
    sStr+=aInput[i].value+"<br />";
    }
    document.getElementById("s").innerHTML=sStr;
    }
 
</script>
</head>
 
<body>
<div >新浪</div>
<input name="b1" type="button" value="改变层内容" onclick="changeLink();" /><br />
<br /><input name="season" type="text" value="春" />
<input name="season" type="text" value="夏" />
<input name="season" type="text" value="秋" />
<input name="season" type="text" value="冬" />
<br /><input name="b2" type="button" value="显示input内容" onclick="all_input()" />
<input name="b3" type="button" value="显示season内容" onclick="s_input()" />
<p ></p>
</body>
</html>

相关文章:

  • 2022-02-26
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2021-09-30
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案