代码是:
<% Response.Charset="GB2312" %>
<% Session.CodePage="936" %>
<form name="form1" method="post" action="5.asp?uuu=9">
<input name=input1 size=70 >
<script language=javascript><!--
var a;var b;var c;
var hou=0;var min=0;var sec=0
var flag=0;idt=window.setTimeout("update();",1000);
function update()
{sec++;
if(sec==60)
{
sec=0;min+=1;
}
if(min==60)
{
min=0;hou+=1;
}
if((min>0)&&(flag==0))
{
flag=1;
}
document.cookie="a1="+sec
document.cookie="b1"+min
document.cookie="c1"+hou
var sec1 = getCookie("a1");
var min1=getCookie("b1");
var hou1=getCookie("c1");
document.form1.input1.value=hou1+"时"+min1+"分"+sec1+"秒";idt=window.setTimeout("update();",1000);
}
function getCookie(cookie_name)
{
var allcookies = document.cookie;
var cookie_pos = allcookies.indexOf(cookie_name);
// 如果找到了索引,就代表cookie存在,
// 反之,就说明不存在。
if (cookie_pos != -1)
{
// 把cookie_pos放在值的开始,只要给值加1即可。
cookie_pos += cookie_name.length + 1;
var cookie_end = allcookies.indexOf(";", cookie_pos);
if (cookie_end == -1)
{
cookie_end = allcookies.length;
}
var value = unescape(allcookies.substring(cookie_pos, cookie_end));
}
return value;
}
//-->
</script>
</form>
运行后文本框显示:时undefined分44秒,小时和分钟没有显示,这是什么问题?
[此贴子已经被阳光白雪于2007-6-20 9:51:46编辑过]