justhrun

bulat_v3.hateemel

Aug 25th, 2014
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.69 KB | None | 0 0
  1. <html><head>
  2. <title>Test</title>
  3. <style type="text/css">
  4.     #background {
  5.         background-color:red;
  6.         width:200px;
  7.         height:200px;
  8.     }
  9.  
  10.     .pokerchip1000{
  11.       background:#555;
  12.       border-radius:50%;
  13.       position:relative;
  14.       border:.5em dashed white;
  15.       transition:all .5s ease;
  16.       backface-visibility:hidden;
  17.       width:5em;
  18.       height:5em;
  19.     }
  20.  
  21.     .pokerchip5000{
  22.       background:green;
  23.       border-radius:50%;
  24.       position:relative;
  25.       border:.5em dashed white;
  26.       transition:all .5s ease;
  27.       backface-visibility:hidden;
  28.       width:5em;
  29.       height:5em;
  30.     }
  31.  
  32.     .pokerchip10000{
  33.       background:blue;
  34.       border-radius:50%;
  35.       position:relative;
  36.       border:.5em dashed white;
  37.       transition:all .5s ease;
  38.       backface-visibility:hidden;
  39.       width:5em;
  40.       height:5em;
  41.     }
  42.  
  43.     .pokerchip25000{
  44.       background:red;
  45.       border-radius:50%;
  46.       position:relative;
  47.       border:.5em dashed white;
  48.       transition:all .5s ease;
  49.       backface-visibility:hidden;
  50.       width:5em;
  51.       height:5em;
  52.     }
  53.  
  54.     .pokerchip50000{
  55.       background:black;
  56.       border-radius:50%;
  57.       position:relative;
  58.       border:.5em dashed white;
  59.       transition:all .5s ease;
  60.       backface-visibility:hidden;
  61.       width:5em;
  62.       height:5em;
  63.     }
  64.  
  65.     .pokerchip100000{
  66.       background:yellow;
  67.       border-radius:50%;
  68.       position:relative;
  69.       border:.5em dashed white;
  70.       transition:all .5s ease;
  71.       backface-visibility:hidden;
  72.       width:5em;
  73.       height:5em;
  74.     }
  75.  
  76.     .text-chip {
  77.         color: white;
  78.         font-weight: bold;
  79.         left: 21px;
  80.         position: absolute;
  81.         top: 31px;
  82.     }
  83. </style>
  84.  
  85. <script type="text/javascript">
  86. <!--
  87. function showValue() {
  88.        var fom = document.test;
  89.        var chip = eval("fom.chip");
  90.  
  91.        var arrCoin = new Array();
  92.  
  93.        var total = eval("fom.total");
  94.        var coin = 0;
  95.        var tcoin = 0;
  96.        var arrchip = [100000,50000,25000,10000,5000,1000];
  97.        total.value = Math.abs(total.value.replace(/\./g,""))+Math.abs(chip.value.replace(/\./g,""));
  98.        var sisa = parseInt(total.value);
  99.        var display = "";
  100.        var display2 = "";
  101.  
  102.        for(i=0;i<7;i++){
  103.                var result = pecah(sisa,arrchip[i]);
  104.                coin = result[0];
  105.                sisa = result[1];
  106.                tcoin += coin;
  107.                if(coin>0) {
  108.                        display2 += '<li>'+ coin + ' x ' + arrchip[i] + '</li>';
  109.                        document.getElementById("showmoney").innerHTML=display;
  110.                        for(var j=0;j<coin;j++) {
  111.                                arrCoin[arrCoin.length] = arrchip[i];
  112.                        }
  113. /*
  114.                        for(x=1;x<=coin;x++){
  115.                                var top = 12*x;
  116.                                display += '<LI style="display: inline; position:absolute; bottom:'+top+'px;"><div style="position:relative;" class="pokerchip'+arrchip[i]+'"><span class="text-chip">'+arrchip[i]+'</span></div></LI>';
  117.                                document.getElementById("chip-bet").innerHTML=display;
  118.                        }
  119. */
  120.                }
  121.        }
  122.  
  123.        var top = 0;
  124.        var jco = 0;
  125.        for(var i=0;i<arrCoin.length;i++) {
  126.                jco = arrCoin[i];
  127.                top = 12*(i+1);
  128.                display += '<LI style="display: inline; position:absolute; bottom:'+top+'px;"><div style="position:relative;" class="pokerchip'+jco+'"><span class="text-chip">'+jco+'</span></div></LI>';
  129.        }
  130.  
  131.        document.getElementById("chip-bet").innerHTML=display;
  132.        display2 += '<b>Total : <font color=red>'+ total.value + ' / ' + tcoin +' coin</b>';
  133.        document.getElementById("showmoney").innerHTML=display2;
  134. }
  135.  
  136. function pecah(ttl,chip) {
  137.        float = ttl / chip;
  138.        if(float>=1) {
  139.                bulat = Math.floor(float);
  140.                sisa  = ttl - (bulat * chip);
  141.                return [bulat,sisa];
  142.        }
  143.        return [0,ttl];
  144. }
  145. //-->
  146. </script>
  147. </head>
  148. <body>
  149. <form method="POST" name="test">
  150. <div id="background" onclick="showValue();" style="margin:150px">
  151. <ul id="chip-bet" style="float: left;width: 100%;padding: 0;margin:0;list-style-type: none;position:relative;top:160px;left:45px"></ul>
  152. </div>
  153. <input type="hidden" name="total" value=0>
  154. <select name="chip">
  155. <option value="1000">1K</option>
  156. <option value="5000">5K</option>
  157. <option value="10000">10K</option>
  158. <option value="25000">25K</option>
  159. <option value="50000">50K</option>
  160. <option value="100000">100K</option>
  161. </select>
  162. </form>
  163. <p id="showmoney"></p>
  164. </body>
  165. </html>
Advertisement
Add Comment
Please, Sign In to add comment