亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

幫忙看看代碼,那里出錯了,,運行不了

幫忙看看代碼,那里出錯了,,運行不了

、_0007 2014-08-26 10:18:00
<!DOCTYPE html><html><head>?<meta charset="UTF-8">?<title>抽獎</title>?<style type="text/css">?*{margin:0;??padding: 0?}.class1{?background-color: #047;?width: 400px;?height: 50px;??margin: 0 auto;?padding-top: 30px;?text-align: center;?font-size: 34;?font-weight: bold;?color: #f00;}.class2{??width: 220px;?height: 30px;??? ??? text-align: center;??? font-weight: bold;??? margin: 0 auto;}.class2 span{display: block;?float: left;?width: 80px;?height: 25px;?line-height: 25px;?background: #036;?border: 1px solid #eee;?border-radius: 7px;?margin-right: 20px;?color: #fff;?text-align: center;?font-size: 14px;?font-family: "微軟雅黑";?cursor: pointer;}</style></head><body><div id="class1" >開始抽獎啦!</div><div><span? id="ksan">開 始</span><span? id="stop">停 止</span></div></body></html><script type="text/javascript">var shuzu=['獎1','2','3','4','5'],t=null;window.onload=function? () {?var ksan=document.getElementById('ksan');?var stop=document.getElementById('stop');?ksan.onclik=kaishi;?stop.onclik=jieshu;??? }function kaishi(){??var ksan=document.getElementById('ksan');?var title=document.getElementById('class1');?clearInterval(t);?t=setInterval(function(){??var redom=Math.floor(Math.random()*shuzu.length);??title.innerHtml=shuzu[redom];?},50);??}?function jieshu(){??clearInterval(t);?}</script>
查看完整描述

2 回答

?
jddod

TA貢獻4條經驗 獲得超2個贊

問題大概是兩個。。第一沒有取到點擊的事件。。二是,innerHtml沒有把值寫進去。。原因的話我覺得可能是取doc節點有問題?但是我覺得你寫的沒問題,試的時候就是取不到。。。所以我就改成直接取了。。本人初學者,請見諒

查看完整回答
反對 回復 2014-08-26
  • 、_0007
    、_0007
    我覺得你寫的和我寫的一樣……為什么onclick放到onload里面就不行呢,,
  • 、_0007
    、_0007
    innerHtml沒有把值寫進去,我把innerHtml的HTML改成大寫就對了。。。
  • 、_0007
    、_0007
    我的onclick拼錯了,,源碼上。。。不好意思。
點擊展開后面1
  • 2 回答
  • 0 關注
  • 1269 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號