<head> <script type="text/javascript"> function setSrc() { var x=document.images x[0].src="http://www.webjx.com/htmldata/sort/hackanm.gif" } </script> </head>
<body> <img src="http://www.webjx.com/htmldata/sort/compman.gif" width="107" height="98" /> <form> <input type="button" onclick="setSrc()" value="Change image"> </form> </body>
</html>
改变图象的宽度
<html> <head> <script type="text/javascript"> function setWidth() { var x=document.images x[0].width="300" } </script> </head>
<body> <img src="http://www.webjx.com/htmldata/sort/compman.gif" width="107" height="98" /> <form> <input type="button" onclick="setWidth()" value="Change Width"> </form> </body>
</html>
定位:
显示当前页的地址和改变当前页的地址
<html> <head> <script type="text/javascript"> function curr_Location() { alert(location) } function change_Location() { window.location="http://www.w3schools.com" } </script> </head>
<body> <form> <input type="button" onclick="curr_Location()" value="Show current URL"> <input type="button" onclick="change_Location()" value="Change URL"> </form> </body>
</html>
刷新页面
<html> <head> <script type="text/javascript"> function refresh() { window.location.reload() } </script> </head>
<body> <form> <input type="button" value="Refresh page" onclick="refresh()"> </form> </body>
</html>
导航对象
检测你的浏览器
<html>
<body> <script type="text/javascript"> document.write("You are browsing this site with: "+ navigator.appName) </script> </body>
</html>
显示浏览器更加详细的信息
<html> <body> <script type="text/javascript"> document.write("<p>Browser: ") document.write(navigator.appName + "</p>")
document.write("<p>Browserversion: ") document.write(navigator.appVersion + "</p>")
document.write("<p>Code: ") document.write(navigator.appCodeName + "</p>")
document.write("<p>Platform: ")
上一篇:网页制作中表单相关特效整理
下一篇:javascript的键盘控制事件
|