位置:首頁 > 軟件操作教程 > 編程開發(fā) > HTML > 問題詳情

html特效代碼 45. 檢測某個網(wǎng)站的鏈接速度

提問人:劉團圓發(fā)布時間:2020-11-02

把如下代碼加入<body>區(qū)域中: 

<script language=Javascript> 

tim=1 

setInterval("tim++",100) 

b=1 

var autourl=new Array() 

autourl[1]="www.njcatv.net" 

autourl[2]="javacool.3322.net" 

autourl[3]="www.sina.com.cn" 

autourl[4]="www.nuaa.edu.cn" 

autourl[5]="www.cctv.com" 

function butt(){ 

document.write("<form name=autof>") 

for(var i=1;i<autourl.length;i++) 

document.write("<input type=text name=txt"+i+" size=10 value=測試中


……> =》<input type=text 

name=url"+i+" size=40> =》<input type=button value=GO


onclick=window.open(this.form.url"+i+".value)><br>") 

document.write("<input type=submit value=刷新></form>") 

butt() 

function auto(url){ 

document.forms[0]["url"+b].value=url 

if(tim>200) 

{document.forms[0]["txt"+b].value="鏈接超時"} 

else 

{document.forms[0]["txt"+b].value="時間"+tim/10+"秒"} b++ } 

function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1 nerror=auto("http://"+autourl+"")>")} 

run()</script>

繼續(xù)查找其他問題的答案?

相關(guān)視頻回答
回復(fù)(0)
返回頂部