1 <head> 2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 3 <title>无标题文档</title> 4 <style> 5 .qq 6 { 7 border:2px solid red;} 8 .ww 9 { 10 border:5px double blue;} 11 </style> 12 </head> 13 14 <body><div style="500px; height:300px; border:1px solid red; line-height:300px;">1241231231</div><br /> 15 <input type="button" value="请点击我" class="qq" onclick="this.className='ww'" /> 16 <div id="me"> 17 <b>试试吧</b> 18 </div> 19 <input type="button" value="请点击" onclick="change()" /><br /> 20 <br /> 21 请输入一个正整数:<input type="text" value="" id="text" /><br /> 22 <input type="button" value="点击计算累加求和" onclick="leijia()" /><br /> 23 <br /> 24 <br /> 25 <input type="button" value="同意(10)" id="aa" disabled="disabled" /><br /> 26 <br /> 27 <br /> 28 请输入三个数,用-隔开:<input type="text" id="ee" /><br /> 29 <input type="button" value="请点击我" onclick="huoqu()" /> 30 </body> 31 </html> 32 <script> 33 var shuzu=new Array(); 34 function huoqu() 35 { 36 var a = document.getElementById("ee").value; 37 shuzu=a.split("-"); 38 alert(shuzu[2]); 39 } 40 var date = new Date();//初始化成为现在的时间 41 date.setFullYear(2008,7,8); 42 alert(date) 43 44 45 46 47 var n = 10; 48 var aa = document.getElementById("aa"); 49 function bian() 50 { 51 n--; 52 if(n==0) 53 { 54 aa.removeAttribute("disabled"); 55 aa.value="同意"; 56 57 } 58 else 59 { 60 aa.value="同意("+n+")"; 61 window.setTimeout("bian()",1000); 62 } 63 } 64 window.setTimeout("bian()",1000); 65 66 67 function leijia() 68 { 69 var a = parseInt(document.getElementById("text").value); 70 var sum = 0; 71 for(var i =1;i<=a;i++) 72 { 73 sum+=i; 74 } 75 alert("刚刚的结果是:"+sum); 76 } 77 function change() 78 { 79 var a = document.getElementById("me"); 80 a.innerHTML="<br /><br /><font color='red'>Hello!</font>"; 81 } 82 83 </script>