为什么这段代码在火狐中跑不起来,但在IE中能跑起来?
<html>
<head>
<title>有奖竞猜</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.unnamed1 { font-size: 45pt; color: #330099}
.title { font-family: "黑体"; font-size: 24pt; color: #666666}
.press { font-family: "黑体"; font-size: 18pt; color: #FF0000}
.press2 { font-family: "黑体"; font-size: 18pt; color: #FFCC33}
td { font-size: 45pt; color: #330099}
-->
</style>
</head>
<body bgcolor="#CCCCCC" onload="press()">
<p> </p>
<p align="center" class="title">有奖竞猜抽奖程序</p>
<p> </p>
<table width="100%" border="1" cellspacing="0" cellpadding="0" id="cj">
<tr bgcolor="#FFFFFF">
<td height="60">
<div align="center"></div>
</td>
</tr>
</table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="ss">
<tr>
<td>
<div align="center" class="press">请按任意键产生中奖名单</div>
</td>
</tr>
</table>
<p align="center" class="press"> </p>
</body>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
flag=1;
paperid = new Array();
paperid[0]="张三 362226790911213";
paperid[1]="李四 365421548752145";
paperid[2]="王五 362464584521454";
paperid[3]="上海 235664584521456";
paperid[4]="河北 756464584521458";
paperid[5]="山西 235234444521434";
paperid[6]="上海 762345432541477";
paperid[7]="天津 234523452344310";
paperid[8]="重庆 768462345321428";
paperid[9]="海南 345223423452334";
paperid[10]="香港 756734564521464";
paperid[11]="西藏 234345344353454";
paperid[12]="湖南 543231334521498";
paperid[13]="四川 123456443521478";
paperid[14]="云南 756464343351487";
paperid[15]="陕西 834524353452312";
paperid[16]="贵州 261786763548843";
paperid[17]="辽宁 234434584521433";
paperid[18]="吉林 892464584521456";
paperid[19]="湖北 456464584521478";
paperid[20]="黑龙江 956464584521402";
function press()
{
if (flag==1)
{
var tmp = Math.round(Math.random()*20);
cj.rows(0).cells(0).innerHTML="<div align='center'>"+paperid[tmp]+"</div>";
setTimeout("press()",100);
}
}
function keyDown()
{
var keycode= event.keyCode;
var realkey = String.fromCharCode(event.keyCode);
if(keycode>0)
{
if(flag==0)
{
flag=1;
press();
ss.rows(0).cells(0).innerHTML='<div align="center" class="press">请按任意键产生中奖名单</div>';
}
else
{
flag=0;
ss.rows(0).cells(0).innerHTML='<div align="center" class="press">请按任意键重新开始</div>';
}
}
}
document.onkeydown=keyDown
//-->
</SCRIPT>
</html>
请问怎么改就能在火狐中跑起来呀
[解决办法]
<html><head><title>有奖竞猜</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css"><!--.unnamed1 { font-size: 45pt; color: #330099}.title { font-family: "黑体"; font-size: 24pt; color: #666666}.press { font-family: "黑体"; font-size: 18pt; color: #FF0000}.press2 { font-family: "黑体"; font-size: 18pt; color: #FFCC33}td { font-size: 45pt; color: #330099}--></style></head><body bgcolor="#CCCCCC" onload="press()"><p> </p><p align="center" class="title">有奖竞猜抽奖程序</p><p> </p><table width="100%" border="1" cellspacing="0" cellpadding="0" id="cj"><tr bgcolor="#FFFFFF"><td height="60"><div align="center"></div></td></tr></table><br><table width="100%" border="0" cellspacing="0" cellpadding="0" id="ss"><tr><td><div align="center" class="press">请按任意键产生中奖名单</div></td></tr></table><p align="center" class="press"> </p></body><SCRIPT LANGUAGE="JavaScript1.2"><!--flag=1;paperid = new Array();paperid[0]="张三 362226790911213";paperid[1]="李四 365421548752145";paperid[2]="王五 362464584521454";paperid[3]="上海 235664584521456";paperid[4]="河北 756464584521458";paperid[5]="山西 235234444521434";paperid[6]="上海 762345432541477";paperid[7]="天津 234523452344310";paperid[8]="重庆 768462345321428";paperid[9]="海南 345223423452334";paperid[10]="香港 756734564521464";paperid[11]="西藏 234345344353454";paperid[12]="湖南 543231334521498";paperid[13]="四川 123456443521478";paperid[14]="云南 756464343351487";paperid[15]="陕西 834524353452312";paperid[16]="贵州 261786763548843";paperid[17]="辽宁 234434584521433";paperid[18]="吉林 892464584521456";paperid[19]="湖北 456464584521478";paperid[20]="黑龙江 956464584521402";function press(){ if (flag==1) { var tmp = Math.round(Math.random()*20); cj.rows[0].cells[0].innerHTML="<div align='center'>"+paperid[tmp]+"</div>";////////////////////////////// setTimeout("press()",100); }}function keyDown(event)////////////////////////////{ event = event || window.event;////////////////////////////////// var keycode= event.keyCode; var realkey = String.fromCharCode(keycode); if(keycode>0) { if(flag==0) { flag=1; press(); ss.rows(0).cells(0).innerHTML='<div align="center" class="press">请按任意键产生中奖名单</div>'; } else { flag=0; ss.rows(0).cells(0).innerHTML='<div align="center" class="press">请按任意键重新开始</div>'; } }}document.onkeydown=keyDown//--></SCRIPT></html>