1. 程式人生 > >html5降龍十八掌-函數,對象,數組的練習

html5降龍十八掌-函數,對象,數組的練習

() AR cti var name 數組 skill kill UNC

<script>
function x1(){

var gj={};
gj.name="侯偉東";
gj.hp=500;
gj.jj=90;
gj.sd=60;
gj.skill=new Array("招式1","招式2","招式3","招式4","招式5","招式6","招式7","招式8","招式9","招式10");
var skillindex=Math.floor(Math.random()*10);
alert(gj.name+gj.skill[skillindex]);
}

</script>
<input type="button" value="十八掌" onclick="x1()"></input>

html5降龍十八掌-函數,對象,數組的練習