首頁  >  文章  >  web前端  >  Document方法的使用_html/css_WEB-ITnose

Document方法的使用_html/css_WEB-ITnose

WBOY
WBOY原創
2016-06-24 11:34:28983瀏覽

<!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 id="node">新浪</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 id="s"></p></body></html>

 

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn