bets

how to set bets

Today,I get one!follow:
element a—>button

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

click element a,we can see it’s value in the last input”text”.
method two:

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

summary:

  • add event with element a : href=”javascript:chips(1000)”
  • add event with element button : onclick=”chips(1000)”
    above all!