标签:round 函数 static logs 定义 base 说明 样式 fun
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>On&Off</title> <script> function mySwitch(){ var oBody = document.getElementById("myBody"); var oOnOff = document.getElementById("myOnOff"); if(oOnOff.src.match("on")){ oOnOff.src="../static/img/off.jpg"; oBody.style.background="black "; oBody.style.color="white"; }else { oOnOff.src="../static/img/on.jpg"; oBody.style.background="white"; oBody.style.color="gray"; } } </script> </head> <body id="myBody"> <nav> <a class="logo" href="/"> <img src="https://ss2.bdstatic.com/8_V1bjqh_Q23odCf/pacific/1185915212.png" alt="Logo"></a> <a href="">我爱淘宝</a> <a href="">春夏款</a> <a href="">秋冬款</a> <a href="">男款</a> <a href="">女款</a> <a href="">童装</a> <input type="text"name="search"> <button type="submit">搜索</button> <img id="myOnOff" onclick="mySwitch()" src="img/on.jpg" width="45px"> </nav> <p></p> </body> </html>
标签:round 函数 static logs 定义 base 说明 样式 fun
原文地址:http://www.cnblogs.com/laifai666/p/7784485.html