& ltmeta name = \" viewport \" content = \" width = device-wi" />
只是看壹看。
& lt!DOCTYPE html & gt
& lthtml lang = " en " & gt
& lthead & gt
& ltmeta charset="UTF-8 " >
& ltmeta name = " viewport " content = " width = device-width,initial-scale=1.0 " >
& lttitle & gt文檔& lt/title & gt;
& lt/head & gt;
& ltbody & gt
& ltbutton id="buySelef " >購買壹個(可選)
& ltbutton id="buyRandom " >購買壹臺(機器選擇)
& ltbutton id = " result " & gt買壹個(抽獎)
& ltdiv id = ' resultList ' & gt
& ltspan & gt結果
& lt/div & gt;
& lt/body & gt;
& lt/html & gt;
& ltscript src = "/libs/jquery/2.1.4/jquery . min . js " & gt;& lt/script & gt;
& lt腳本& gt
窗戶。prize = { lottery results:0 };
$("#buySelef ")。單擊(函數(){
var num = math . floor(math . random()*(300-100))+100;
$("#resultList ")。追加(' & ltp & gt可選結果:'+num+' & lt;“p & gt”);
})
$("#buyRandom ")。單擊(函數(){
var num = math . floor(math . random()*(300-100))+100;
$("#resultList ")。追加(' & ltp & gt機器選擇結果:'+num+'
})
$("#result ")。單擊(函數(){
如果(窗口。Prize . LotteryResults & lt=0)
{
var num = math . floor(math . random()*(300-100))+100;
窗戶。Prize . LotteryResults = num
}
否則{
var num =窗口。prize . lottery結果;
}
$("#result ")。追加(' & ltp & gt抽獎結果:'+num+' & lt;“p & gt”);
})
& lt/script & gt;