location和setInterval的结合使用
2012-08-20 09:29
134 查看
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'js3.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="js/jquery-1.2.6.js"></script>
<script type="text/javascript">
go = function(){
location = "http://www.baidu.com";
}
var time = 5;
function show(){
time--;
document.getElementsByTagName("span")[0].innerText = time;
if(time == 0)
{
location = "http://www.baidu.com";
}
}
setInterval("show()",1000);
</script>
</head>
<body>
<div>
<span>5</span>秒后自动跳转到百度 <input type="button" value="提交" onclick="go()"/>
</div>
</body>
</html>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'js3.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="js/jquery-1.2.6.js"></script>
<script type="text/javascript">
go = function(){
location = "http://www.baidu.com";
}
var time = 5;
function show(){
time--;
document.getElementsByTagName("span")[0].innerText = time;
if(time == 0)
{
location = "http://www.baidu.com";
}
}
setInterval("show()",1000);
</script>
</head>
<body>
<div>
<span>5</span>秒后自动跳转到百度 <input type="button" value="提交" onclick="go()"/>
</div>
</body>
</html>
相关文章推荐
- 使用Origin将不同的图片结合在一起
- Lucene基础(四)-- 结合数据库使用
- 使用4.3.11版本的hibernate结合druid连接池遇到的问题
- (原创)关于PopupWindow的showAsDropDown()和showAtLocation()使用方式及其区别
- ReactNative-结合定时器使用ActivityIndicator
- vue和animate.css怎么结合使用
- Java 使用poi导入excel,结合xml文件进行数据验证的例子(增加了jar包)
- 使用rapid-framework3.5结合sqlserver2005快速开发
- 【编码随笔】使用fprintf调试,结合使用fopen、fclose
- ios xcode中所有自带的字体如下(最好结合NSMutableAttributedString相结合使用)
- 使用objectdatasource结合数据绑定控件进行简单三层架构的开发
- 如何结合使用 Subversion 和 Eclipse
- angular1与jquery结合使用注意项
- mvc和spring的结合使用
- setInterval和setTimeout的使用区别(转自 <a href="http://www.cnblogs.com/sk-net/archive/2008/01/24/1050770.html">http://www.cnblogs.com/sk-net/archive/2008/01/24/1050770.html</a>)
- jquery imgareaselect 使用利用js与程序结合实现图片剪切
- BroadcastReceiver与Notification的结合使用实现短信完全自主接收
- 如何使用gdb结合qemu调试linux内核源码
- google map api 与jquery结合使用(3) --图标样式,使用xml和异步请求【转帖】
- sass结合compass使用(图文)