遊戲網站的bets是如何下的

遊戲網站投賭注,點擊選擇數字顯示在文本框,如何實現的,首先想到的極可能就是給button綁定事件,以下:javascript

<style type="text/css">
    button{
        display: block;
        width: 40px;
        height: 30px;
        margin-bottom: 10PX;
        text-align: center;
        background-color: #000;
        color: #fff;
        border: 0;
        line-height: 30px;
    }
</style>
</head>
<body>
    <button onclick="chips(1000)">1k</button>
    <button onclick="chips(2000)">2k</button>
    <div>
        <input type="text" name="getdaolors" id="betsLeft">
    </div>
    
    <script type="text/javascript">
        function chips (value) {
            var betsLeft=document.getElementById("betsLeft");
            betsLeft.value=value;
        }
    </script>
</body>

實踐了一下是能夠實現的,遊戲網站採用的是a標籤。第一,a標籤樣式更好調整設計,自身帶有的樣式少。以下(js純本身「編造」哈)css

<head>
<style type="text/css">
    a{
        display: block;
        width: 40px;
        height: 30px;
        margin-bottom: 10PX;
        text-align: center;
        background-color: #000;
        color: #fff;
        text-decoration: none;
        line-height: 30px;
    }
</style>
</head>
<body>
    <a href="javascript:chips(1000)">1K</a>
    <a href="javascript:chips(2000)">2K</a>
    <div>
        <input type="text" name="getdaolors" id="betsLeft">
    </div>
    
    <script type="text/javascript">
        function chips (value) {
            var betsLeft=document.getElementById("betsLeft");
            betsLeft.value=value;
        }
    </script>
</body>

以上!
目前只想到這兩種實現了,歡迎補充!java

相關文章
相關標籤/搜索