<!DOCTYPE html>
<html lang="en"><head> <meta charset="UTF-8"> <title></title> <style type="text/css">.d1{ background: green; color: red; padding: 15px; text-align: center;}.d2{ border:2px solid orange; font-size: 30px; height: 50px;} </style></head><body> <h4 id="bt" class="bt cc">休息休息</h4> <a id="aid" href="http://www.baidu.com" target="_self" title="">百度</a> <input type="text" id="xh" class="xh" value="123456"><br> <input type="text" id="xm" class="xingm" value="熊二"></input><br> <input type="text" id="sxcj" class="sxcj" name="fs" value="60"></input><br> <input type="text" id="yycj" class="yycj" name="fs" value="70"></input><hr> <input type="button" value="单机" οnclick="myfun1()"> <input type="button" value="单机" οnclick="myfun2()"> <input type="button" value="单机" οnclick="myfun3()"> <input type="button" value="单机" οnclick="myfun4()"><script> var bb=document.getElementById('bt'); var fs=document.getElementsByName('fs'); var inp=document.getElementsByTagName('input'); var a1=document.getElementById('aid');// bt.innerHTML='学生信息<em>查询</em>';// alert(fs[0].id);// alert(fs[1].value);// alert(fs[0].className);function myfun1(){ a1.innerHTML='163'; a1.target='_blank'; a1.href='http://www.163.com'; a1.style.color='#00f';}function myfun2(){ inp[0].value='88888'; inp[1].value='gouxing'; fs[0].value='90'; fs[1].value='100'; inp[0].style.background='red';}function myfun3(){ bb.style.textShadow='2px 3px 3px #ff0000';bb.style.fontSize='40px';bb.style.background='rgba(150,50,25,0.2)';}function myfun4(){ bb.className='d1'+' '+'d2';}</script> </body></html>