分享JavaScript
Google.cn
public domain books
该代码会遍历当前网页上的所有链接,然后以随机的方式打开其中一个链接
第一步:
在<head>区域添加下面的脚本代码
<script>
/*****************************************************
* Share JavaScript (http://www.ShareJS.com)
* 使用此脚本程序,请保留此声明
* 获取此脚本以及更多的JavaScript程序,请访问 http://www.ShareJS.com
******************************************************/
function random_all(){
var myrandom=Math.round(Math.random()*(document.links.length-1))
window.location=document.links[myrandom].href
}
</script>
第二步:
在<body>区添加一按钮
在<input>中加入 onClick=random_all()
如:
<input onClick=random_all() type=button value="随便看一看" name="button">




