游戏网站的bets是怎样下的

游戏网站投赌注,点击挑选数字显现在文本框,怎样完成的,起首想到的极可能就是给button绑定事宜,以下:

<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纯本身“假造”哈)

<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>

以上!
现在只想到这两种完成了,迎接补充!

    原文作者:_ipo
    原文地址: https://segmentfault.com/a/1190000005357580
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞