当前页面: 开发资料首页 → Javascript 专题 → 真正的 用JS 做的 loading
摘要: 真正的 用JS 做的 loading
这个loading 需要2个页面的的支持,还可以为一个站点的所有html设置这个loading程序
function WriteButton(fnFunctionName, ButtonValue, ButtonURL, wd)
{
var strTmp = "",n = 0;
if (fnFunctionName == "")
strTmp = "self.location = '" + ButtonURL + "';";
else
strTmp = fnFunctionName + '();';
for(var i = 0; i < ButtonValue.length; i++)
{
var c = ButtonValue.substr(i, 1);
if( c > "z" || c < "A")
n += 2;
else
n += 1;
}
if( wd == "") wd = (n * 8);
document.write("<table title="+ButtonURL+" width=" + wd + "><tr><td align=center class=btn onmouseup=\"javascript:this.className='btu'\" onmousedown=\"javascript:this.className='btd'\" onmouseover=\"javascript:this.className='btu'\" style=\"FONT-SIZE:12px;TEXT-DECORATION:none\" onclick=\"javascript:this.className='btd';" + strTmp + "\" onmouseout=\"javascript:this.className='btn'\">" + ButtonValue + "</td></tr></table>");
}
function wtdiv()
{
document.write("
function openwin()
{
if(self == window.parent.frames['t'] && top.parent.frm)
top.parent.frm.rows = '*,0';
else if(top.parent.frm) top.parent.frm.rows = '0,*';
}
var wt = 0, n = 0;
function countwt()
{
if (wt)
clearTimeout(wt);
wtime.innerHTML = "" + n++ ;
wt = setTimeout("countwt();", 1000);
}
function showdiv()
{
openwin();
document.getElementById("stdiv").style.visibility = "visible";
countwt();
}
openwin();
最后的说明
在您的i.htm,也就是您的真正的index.htm首页里加入如下代码就可以
<body>后加
<script src=h.js></script>
</body>前加入
<script src=to.js></script>
就可以了
不明白的可以访问我的网站 http://m9m.nease.net 或 来信和我交流
QQ: 11602011