jQuery自动切换/点击切换选项卡效果的小例子
代码如下:
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "https://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk">
<title>404 not found</title>
</head>
<body>
<h1>找不到指定的页面</h1>
<span id="totalsecond">3</span>秒后自动返回
</body>
<script language="javascript" type="text/javascript">
<!--
var second = document.getelementbyid('totalsecond').textcontent;
if (navigator.appname.indexof("explorer") > -1) //判断是ie还是firefox浏览器,采用相应措施取得秒数
{
second = document.getelementbyid('totalsecond').innertext;
} else
{
second = document.getelementbyid('totalsecond').textcontent;
}
setinterval("redirect()", 1000); //每1秒钟调用redirect()方法一次
function redirect()
{
if (second < 0)
{
location.href = 'https://要跳转的网站';
} else
{
if (navigator.appname.indexof("explorer") > -1)
{
document.getelementbyid('totalsecond').innertext = second--;
} else
{
document.getelementbyid('totalsecond').textcontent = second--;
}
}
}
-->
</script>
</html></td>
</tr>
</table>