欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

jQuery自动切换/点击切换选项卡效果的小例子

程序员文章站 2024-01-22 09:03:34
代码如下:

代码如下:


<!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>