为什么按回车键不停止
<script type="text/javascript">
var date=['手机','电脑','手表','相机','打印机','谢谢参与','50元充值卡','1000元购物卷']
timer=null;
flog=true;
window.onload=function()
{
var play=document.getElementById('play');
var stop=document.getElementById('stop');
play.onclick=playfun;
stop.onclick=stopfun
document.onkeyup= function (event)
{
event=event || window.event;
if(event.keyCode==13)
{
if(flog==true)
{
playfun();
flog=false
}
}
else
{
stopfun();
flog=true
}
}
function playfun()
{
var that=this;
var title=document.getElementById('title');
clearInterval(timer);
timer=setInterval(function()
{
var random=Math.floor(Math.random()*date.length);
title.innerHTML=date[random];
},200);
play.style.background='#999'
}
function stopfun()
{
clearInterval(timer);
var play=document.getElementById('play');
play.style.background='#0077b3'
}
};
// 开始抽奖