抽选系统加计数系统 计算四种选项被抽选的次数 统计次数的代码是?

<script language="javascript">

function rolling(){

var maxNum = 4;  

var minNum = 1;  

var n = Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum;

document.getElementById("center").innerHTML="<img src='images/" + n + ".jpg' width='90'>";

}

</script>

<body>


<table width="300" align="center">

  <tbody>

    <tr>

      <td>&nbsp;</td>

      <td id="top"><img src="images/white.png" width="90"></td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td id="left"><img src="images/Ice_Block_icon.png" width="90"></td>

      <td id="center"><img src="images/201592412105418.png" width="90"></td>

      <td id="right"><img src="images/No.png" width="90"></td>

    </tr>

    <tr>

      <td>&nbsp;</td>

      <td id="bottom"><img src="images/heart-50-xxl.png" width="90"></td>

      <td>&nbsp;</td>

    </tr>

    <tr>

      <td>&nbsp;</td>

      <td><input type="button" value="抽选" id="btn_rolling" onClick="rolling();"></td>

      <td>&nbsp;</td>

    </tr>

  </tbody>

</table>

<p>


慕少6133084
浏览 1244回答 1
1回答

AllySu

document.getElementById("center").innerHTML发生变化时为一次?
打开App,查看更多内容
随时随地看视频慕课网APP