JSP源代码大全 倒计时代码生成器
请参照以下的原代码,注意:可以替换JavaScript码中的2007
以下是网页源代码
<!-- 分三步完成全部脚本:
1. 将第一部分粘贴到HTML的HEAD区
2. 将OnLoad事件加入BODY标签内
3. 将最后一部分代码加入BODY区 -->
<!-- 第一步: 将如下代码粘贴到HTML的HEAD区-->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var Temp2;
var timerID = null;
var timerRunning = false;
function arry() {
this.length = 12;
this[0] = 31;
this[1] = 28;
this[2] = 31;
this[3] = 30;
this[4] = 31;
this[5] = 30;
this[6] = 31;
this[7] = 31;
this[8] = 30;
this[9] = 31;
this[10] = 30;
this[11] = 31;
}
var date = new arry();
function stopclock() {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock() {
stopclock();
showtime();
}
function showtime() {
now = new Date();
var CurMonth = now.getMonth();
var CurDate = now.getDate();
var CurYear = now.getFullYear();
now = null;
if (1 < CurDate) {
CurDate -= date[CurMonth]; CurMonth++;
}
if (0 < CurMonth) {
CurMonth -= 12; CurYear++;
}
var Yearleft = 2007 - CurYear;
var Monthleft = 0 - CurMonth;
var Dateleft = 1 - CurDate;
document.dateform.a.value = Yearleft;
document.dateform.b.value = Monthleft;
document.dateform.c.value = Dateleft;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
// End -->
</script>
</HEAD>
<!-- 第二步:将OnLoad事件加入BODY标签内 -->
<BODY Onload="startclock()">
<!-- 第三步:将最后一部分代码加入BODY区 -->
<form name=dateform>距离2007还有
<input type=text name=a size=2 value="">年
<input type=text name=b size=2 value="">月
<input type=text name=c size=2 value="">天
</form>
<!-- 代码长度: 1.95 KB -->
相关文档:
表结构:
CREATE TABLE `article` (
`id` int(10) unsigned ......
//运行图:
//连接字符串
String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;
Class.forName(driverName).newInstance();
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
//每页显示记录数
int PageSize ......
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java"%>
<%@ page info="database handler"%>
<%@ page import="java.io.*"%>
<%@ page import="java.lang.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%> ......
一、先看看如何取当前时间并显示的代码:
------------------------------------------------
<%
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date currentTime = new java.util.Date();//得到当前系统时间
String str_date1 = formatter.form ......
<%@ page contentType="text/html;charset=GBK"%>
<div id="divDisable" style="display: none;width:expression(document.body.offsetWidth); height:100%; z-index: 1000; position: absolute;left: 0px; top: 0px;filter:alpha(opacity=50); background-color:White">
</div>
<div id="divWaiti ......