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 -->
相关文档:
一、page 对象
page对象代表JSP本身,更准确地说它代表JSP被转译后的Servlet,它可以调用Servlet类所定义的方法。
二、config 对象
config 对象里存放着一些Servlet 初始的数据结构。
config 对象实现于javax.servlet.ServletConfig 接 ......
Action代码
package com.zxc.action;import java.net.URLEncoder;public class XiaoZAction {
private String username; public String getUsername() { return username; }
public String execute() throws Exception{
username = URLEncoder.encode("周小川", "utf-8"); return "success"; }}
struts.x ......
J2EE 探索者:
创建和管理有状态 Web 应用程序
对4种会话作用域的适当处理
文档选项
将此页作为电子邮件发送
拓展 Tomcat 应用
......