按钮中添加点击事件setInterval没反应
<script type="text/javascript">
function demo2()
{
alert("hello");
}
var statr=document.getElementById("btn_ok");
var stop=document.getElementById("btn_stop");
statr.onclick=function()
{
var a=setInterval(function()
{
demo2();
},1000);
};
stop.onclick=function()
{
clearTimeout(a);
};
</script>
</head>
<body>
<input type="button" id="btn_ok" value="开始弹窗" />
<input type="button" id="btn_stop" value="停止弹窗" />
</body>