8
<html> <head> <script type='text/javascript'> function a(){alert('aaaa'); //parselnt()字符 //innerHTML标记内容 var d1=document.getElementById('d1') d1.style.display='block' } function b(){ var A=document.getElementsByName('r1'); var result=''; for(var i=0;i<A.length;i++){ if(A[i].checked){ result=A[i].value;}}alert(result)} function c(){ var s1=document.getElementById('s1'); /* var A=s1.options var result=''; for(var i=0;i<A.length;i++){ if(A[i].selected){ result=A[i].text;}}*/ var result=s1.options[s1.selectedIndex].text alert(result)} </script> </head> <body> <input type='button'value='click'onclick='a()'/><br/> <a href='javascript:b()'>智慧城市学院</a><br/> <a href='javascript:c()'>艺术学院</a><br/> <hr/> <div id='d1'style='display:none'> a:<input type='radio'value='a'name='r1'/> b:<input type='radio'value='b'name='r1'checked/> c:<input type='radio'value='c'name='r1'/> d:<input type='radio'value='d'name='r1'/> <hr/> <select id='s1'> <option>a</option> <option selected>b</option> <option>c</option> <option>d</option> </div> <span></span> </body> </html>
<html> <head> <style type="text/css"> body{ background:gray; text-align:center; margin:0px; padding:0px; } #wrapper{ width:800px; background:white; margin:0 auto; text-align:left; } #branding{ background:#aaaaaa; height:130px; text-align:center; } #branding div{ font-size:200%; line-height:100px; text-align:center; } #branding ul{ list-style:none; margin:0px; padding:0px; } #branding ul a{ text-decoration:none; background:black; color:white; line-height:2em; border-right:solid white 1px; padding:0 2em; float:right; } #branding ul a:hove: { background:#ffffff; color:black; } #content{ background:yellow; width:600px; margin:0px; padding:0px; float:left; } img{ float:right; padding:10px; margin:10px; border-style:none; background-color:white; } #footer{ background:black; color:white; height:80px; line-height:80px; font-size:1em; text-align:center; clear:both; } </style> <script type="text/javascript"> function a(){ var t1 = document.getElementById("t1") var t2 = document.getElementById("t2") var oper = document.getElementById("oper") var s1 = document.getElementById("s1") var result="" switch(oper.value){ case '+':result=parseInt(t1.value)+parseInt(t2.value);break; case '-':result=parseInt(t1.value)-parseInt(t2.value);break; case '*':result=parseInt(t1.value)*parseInt(t2.value);break; case '/':result=parseInt(t1.value)/parseInt(t2.value);break; } s1.innerHTML = result } function b(){ var q=document.getElementById("q") q.style.display="block" } function c(){ var q=document.getElementById("q") q.style.display="none" } </script> </head> <body> <div id="wrapper"> <div id="branding"> <div>秦欣琪</div> <ul> <li><a href="javascript:c()">隐藏计算器</a></li> <li><a href="javascript:b()">显示计算器</a></li> <li><a href="#">商务学院</a></li> <li><a href="#">机器人学院</a></li> <li><a href="#">智慧城市学院</a></li> </div> <div id="content"> <div> <img src="1.jpg" width="50px" height="80px" /> </div> <div id="q"> <input type="text" id="t1"/> <select id="oper"> <option value="+">+</option> <option value="-">-</option> <option value="*">*</option> <option value="/">/</option> </select> <input type="text" id="t2"/> <input type="button" value="=" onclick="a()"/> <span id="s1"></span> </div> 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> 哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈 </div> <div id="footer"> Copyright@buu.edu.cn </div> </div> </body> </html>