iT邦幫忙

0

有沒有單純秀中獎名單程式或是用怎樣方式寫比較好除了Excel以外

匿名 2012-12-04 20:49:114580 瀏覽
  • 分享至 

  • xImage

請問有沒有用哪種程式容易寫出抽獎選項、中獎人直接可以秀出來程式

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

34
wiseguy
iT邦超人 1 級 ‧ 2012-12-04 21:54:30
最佳解答

最簡單就是 html + javascript 囉!以下範例把所有人的名字加上去就行了。按一次就抽一位。

<pre class="c" name="code">

  
  <meta http-equiv="content-type" content="text/html; charset=big5">
  <title></title>
	<script>
	var all = new Array(
	'王大頭',
	'李大條',
	'林大光',
	'張小明',
	'陳小西'
	);

	function choose()
	{
		document.getElementById('luckyGuy').innerHTML = all[Math.floor(Math.random()*all.length)];
	}
	</script>
  
  
	<form>
		<input type="button" value="請抽獎" onclick="choose();">
	</form>
	<h1 align="center">得獎的是:<span id="luckyGuy">   </span></h1>
  

因應個資法 是不是要在中間自動加上*疑惑

wiseguy iT邦超人 1 級 ‧ 2012-12-06 13:51:53 檢舉

這就留給樓主發揮囉~

匿名 檢舉

恩恩~多謝!!!!顯示方面我再想看看~~~

我要發表回答

立即登入回答