常用的几段javascript代码分享

时间:2014-03-25    点击:65   
1.3秒后自动返回
复制代码 代码如下:

<span id="totalSecond">3</span>秒后自动返回

<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 = 'http://www.baidu.com';
} else
{
if (navigator.appName.indexOf("Explorer") > -1)
{
document.getElementById('totalSecond').innerText = second--;
} else
{
document.getElementById('totalSecond').textContent = second--;
}
}
}
-->
</script>
Node.js模拟浏览器文件上传示例
JavaScript关闭当前页面(窗口)不带任何提示
JavaScript数字和字符串转换示例
jquery实现瀑布流效果分享
Jquery对数组的操作技巧整理
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved