常用的几段javascript代码分享
2014-03-25 00:00
549 查看
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>
相关文章推荐
- 常用的几段javascript代码分享
- Javascript常用字符串判断函数代码分享
- Javascript常用字符串判断函数代码分享
- 项目常用Javascript分享,包含常用验证和Cookie操作
- 经典常用的javascript代码收藏
- css 填坑常用代码分享
- [转]JavaScript页面跳转常用代码
- 常用到的javaScript技术代码
- 部分常用JavaScript代码
- Javascript表单特效之十大常用原理性样例代码大总结
- Javascript 常用代码大全
- 两种常用的javascript数组去重方法思路及代码
- Github分享:精心收集的48个JavaScript代码片段,仅需30秒就可理解!
- javascript 常用代码大全(3)
- javascript 常用代码大全
- jquery博客分享一些php常用代码(二)
- Javascript页面跳转常用代码
- JavaScript图片放大技术(放大镜)实现代码分享
- javascript 常用代码大全(超级收藏,强烈推荐)