<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <link rel="stylesheet" href="/portal/css/index.css" type="text/css"> <title>网络速度指数测试----蓝色新感觉</title> <style type="text/css"> <!-- body { background-image: url(/HAS_Client/buy/img/host_speed.jpg); } --> </style> </head> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align='center'> <script language="Javascript"> tim = 1; setInterval("tim++", 10); b = 1; var autourl = new Array(); autourl[1] = "cb-h4.hichina.com"; autourl[2] = "cz-h1.hichina.com"; function check() { var formplace = ""; //首页主机放置地点测试 formplace = ""; if (typeof (formplace) == "object") { for (i = 0; i < formplace.length; i++) { if (((formplace[i].value).split("/"))[1] == document.all["hostplace"].innerText) { formplace[i].selected = true; break; } } } } function butt() { document.write("<form name=autof action='' onsubmit='check();'><br>网络速度指数测试<br>"); for (var i = 1; i < autourl.length; i++) { document.write("<br><input type=text name=txt" + i + " size=32 value=测试中……>") } document.write("<br><br>"); document.write("<p id='anti' style='Display:none'>在您本地访问<font color=red><span id='hostplace'></span></font>机房速度较快,推荐选择."); document.write("<input type=hidden name=vstyle value=ok>"); document.write("<br><input type=submit name=ok value='重新测试'><input type=button name=h value=' 关 闭 ' onclick='window.close()'></p></form>"); } function auto(url) { var urlName; if (url == "http://cb-h4.hichina.com") { urlName = "中国电信"; } else { urlName = "中国网通"; } if (tim > 4000) { document.forms[0]["txt" + b].value = urlName + "链接超时"; } else { document.forms[0]["txt" + b].value = urlName + "机房速度指数:" + adv_format(18000 / tim, 2); } if (b == 2) { document.all["anti"].style.display = ''; document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0, 4); } b++; } function run() { for (var i = 1; i < autourl.length; i++) { setTimeout("EditTimeout" + i + "('" + autourl[i] + "')", 45000); document.write("<img src=http://" + autourl[i] + "/test_pic.jpg?" + Math.random() + " width=1 height=1 onLoad=auto('http://" + autourl[i] + "')> ") //document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://"+autourl[i]+"')>"); } } function EditTimeout1(url) { var urlName; if (url == "cb-h4.hichina.com") urlName = "中国电信"; else urlName = "中国网通"; if (document.forms[0]["txt1"].value == "测试中……") document.forms[0]["txt1"].value = urlName + "链接超时"; else if (document.forms[0]["txt2"].value == "测试中……") document.forms[0]["txt2"].value = urlName + "链接超时" document.all["anti"].style.display = ''; document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0, 4); } function EditTimeout2(url) { var urlName; if (url == "cb-h4.hichina.com") urlName = "中国电信" else urlName = "中国网通" if (document.forms[0]["txt1"].value == "测试中……") document.forms[0]["txt1"].value = urlName + "链接超时" else if (document.forms[0]["txt2"].value == "测试中……") document.forms[0]["txt2"].value = urlName + "链接超时"; document.all["anti"].style.display = ''; document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0, 4); } function MM_openBrWindow(theURL, winName, features) { //v2.0 window.open(theURL, winName, features); } function adv_format(value, num) //四舍五入 { var a_str = formatnumber(value, num); var a_int = parseFloat(a_str); if (value.toString().length > a_str.length) { var b_str = value.toString().substring(a_str.length, a_str.length + 1); var b_int = parseFloat(b_str); if (b_int < 5) { return a_str } else { var bonus_str, bonus_int; if (num == 0) { bonus_int = 1; } else { bonus_str = "0."; for (var i = 1; i < num; i++) bonus_str += "0"; bonus_str += "1"; bonus_int = parseFloat(bonus_str); } a_str = formatnumber(a_int + bonus_int, num) } } return a_str } function formatnumber(value, num) //直接去尾 { var a, b, c, i; a = value.toString(); b = a.indexOf('.'); c = a.length; if (num == 0) { if (b != -1) a = a.substring(0, b); } else { if (b == -1) { a = a + "."; for (i = 1; i <= num; i++) a = a + "0"; } else { a = a.substring(0, b + num + 1); for (i = c; i <= b + num; i++) a = a + "0"; } } return a } butt(); run(); </script> </td> </tr> </table> </body> </html>