<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript">
$(function(){
numberTable = new Array("1","2","3","4","5","6","7","8","9","10",
"11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30",
"31","32","33","34","35","36","37","38","39");
var nums = $('#character :input');
//將按鈕的值放入
nums.each(function(k){
$(this).val( numberTable[k] );
});
//挷定按鈕的事件
nums.bind('click',function(){
var choVal = $('#choice').val();
if(choVal!= ''){
splitArr = choVal.split(",");
//禁止重覆選號
for(i=0;i<splitArr.length;i++){
if( $(this).val() == splitArr[i] ){
return false;
}
}
//禁止超過5個選號
if(splitArr.length == 5){return false;}
}
if( choVal == ''){
choVal = $(this).val();
}else{
choVal += "," + $(this).val();
}
$('#choice').val( choVal );
});
//自動選號
$('#auto').bind('click',function(){
randomCho(5,39);
});
//送出檢查
$('#send').bind('click',function(){
var choVal = $('#choice').val();
splitArr = choVal.split(",");
//檢查數量
if(splitArr.length != 5){
alert("選號不足5個!");
return false;
}else{
//排序
splitArr.sort(myUpSort);
//加逗號
popStr = splitArr.join(",");
if(confirm("親愛的玩家您好:您選的號碼是 "+popStr+" 確認選號確認後,我們將於您的帳戶中扣取10,000點紅利 。") ){
$('#form1').submit();
}else{
/* location.reload(); */
}
}
});
function randomCho(total,maxNum){
var numberTable = new Array("1","2","3","4","5","6","7","8","9","10",
"11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30",
"31","32","33","34","35","36","37","38","39");
var numArray = new Array();
var reStr = "";
for(var i=0;i<total;i++){
var index = Math.floor(Math.random()*(maxNum-1)); //亂數產生0~38之間的數字
numArray.push( numberTable[index] );
//將選到的數字從陣列中刪掉,避免重覆…
numberTable.splice(index,1);
maxNum--;
}
//排序
numArray.sort(myUpSort);
//加逗號
reStr = numArray.join(",");
//console.log( reStr );
$('#choice').val(reStr)
}
//遞增排序
function myUpSort(x,y){return x-y}
});
</script>
2011年1月12日 星期三
Jquery樂透彩選號程式
2011年1月4日 星期二
AMFPHP 連結 PHP時出現 Error #2044 錯誤
剛開始用amfphp連結PHP時就一直有這個問題…
一直找不出原因和解決的方法…
不過用brower去run卻又都很正常,後來就沒有繼續找答案…
今天有上網找了一下,終於看到了答案…
參考的網頁:
http://www.shch8.com/blog/post/72.html
試了一下,發現只要將amfphp的gateway.php裡面的
$gateway->disableStandalonePlayer();
這行註解掉就行了…
其實答案就在gateway.php裡頭的註釋就有了,
卻一直沒有花一點時間去好好看看gateway.php這個檔…orz...
如下:
// Keep the Flash/Flex IDE player from connecting to the gateway.
一直找不出原因和解決的方法…
不過用brower去run卻又都很正常,後來就沒有繼續找答案…
今天有上網找了一下,終於看到了答案…
參考的網頁:
http://www.shch8.com/blog/post/72.html
試了一下,發現只要將amfphp的gateway.php裡面的
$gateway->disableStandalonePlayer();
這行註解掉就行了…
其實答案就在gateway.php裡頭的註釋就有了,
卻一直沒有花一點時間去好好看看gateway.php這個檔…orz...
如下:
// Keep the Flash/Flex IDE player from connecting to the gateway.
Used for security to stop remote connections.
原來直接在flash CS5裡面直接run AMFPHP(standalone?)
本來基於安全的理由就會被禁止的,用brower去連就沒有這樣的問題了:)
訂閱:
文章 (Atom)