当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery自动切换/点击切换选项卡效果的小例子

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

2018年09月14日  | 移动技术网IT编程  | 我要评论

代码如下:


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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网