javascript的自动页面跳转代码
方法一(动画效果): <html xmlns ="http://www.w3.org/1999/xhtml" > <head> <meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" /> <title> Loading </title> </head>
<body>
<form name ="loading" >
<p align ="center" > 正在跳转,请稍后... </p>
<p align ="center" > <input type ="text" name ="bar" style ="border-style:none; background-color:#D3E8D0; font-weight:bold" /> <input type ="text" name ="percentage" style ="border-style:none; background-color:#FFFFFF; max-width:30px" /> </p>
<p align ="center" > 如果您的浏览器不支持跳转,请点击 <a href ="http://www.515zhao.com" > 这里 </a> 手动跳转 </p>
<script language ="javascript" type ="text/javascript" > var percent= 0 ; //百分比进度,显示在滚动条后面 var element= "||" ; //滚动条单元竖线 var elements= "||" ; //滚动条当前竖线 count(); //开始调用循环
function count(){ percent=percent+ 10 ; //每次百分比加10 elements =elements + element; //滚动条当前竖线增加一个滚动条单元竖线 document.loading.bar.value=elements; //设置窗体loading表单中bar元素的当前值 document.loading.percentage.value=percent+ "%" ; //设置窗体loading表单中percentage元素的当前值 if (percent< 99 ){ //percent小于99则继续循环 setTimeout( "count()" , 500 ); //每500ms进行一次count() } else { window.location = "http://www.515zhao.com" ; //percent达到100时跳转 } } </script>
</form> </body> </html>
方法二: <html> <head> <meta http-equiv ="refresh" content ="3; url=http://www.515zhao.com" > </head> <a href ="http://www.515zhao.com" > 如果您的浏览器没有自动跳转,请点击这里 <a/> </html>
多谢!解决了 不过,我觉得 <a href="javascript:void(window.open('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100'));" >Open 1.htm</a> 和 <a href="javascript: var win=window.open ('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100')" >Open 1.htm</a> 最好。 <a href="#" onclick="window.open('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100')" >Open 1.htm</a>
<a href="#" onclick="window.open('top.htm','_parent')" >Open dddddhtm</a> //原来页面 点击后,原窗口的联接地址会发生变化,加上了#,感觉不太好:)虽然也能实现功能。
--出自网上。
|