aboutsummaryrefslogtreecommitdiffstats
path: root/tests/html/test-inputs.html
blob: 9692634cadc674a9453b0a85611679c5846b55b5 (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<style>
</style>
<form>
<div><input type="checkbox"></div>
<div><input type="text" size="30" value="placeholder"></div>
<div><input type="text" size="10" value="whefghijklmnopqrstuvwxyzabcdefg"></div>
<div><input id=bar1 type="text" value=""></div>
<div><button id=setdefaultvalue type=button>setDefaultValue</button>
    <button id=setvalue type=button>setValue</button></div>
<div><input id=foo1 type="checkbox"></div>
<div><input id=foo2 type="checkbox"></div>
<div><input id=foo3 type="checkbox"></div>
<div><button id=setdefault type=button>setDefaultChecked</button></div>
<div><input type="submit"><input type="reset"><div>
<div><input id=ch type="checkbox" checked></div>
<div><input id=unch type="checkbox"></div>
<div><input type="text" size="30" placeholder="this is a placeholder"></div>
<div><input type="password" size="30" placeholder="this is a password placeholder"></div>
<script>
document.getElementById("ch").indeterminate = true;
document.getElementById("unch").indeterminate = true;
var checkboxes = [document.getElementById("foo1"),
                  document.getElementById("foo2"),
                  document.getElementById("foo3")];
var textinput = document.getElementById("bar1");
var set_default_checked = document.getElementById("setdefault");
var set_default_value = document.getElementById("setdefaultvalue");
var set_value = document.getElementById("setvalue");
var x = 0;

set_default_checked.addEventListener("click", function () {
    for (var i = 0; i < 3; i++) {
        checkboxes[i].defaultChecked = (i == x);
    }
    x = (x + 1) % 3;
});

set_default_value.addEventListener("click", function () {
    textinput.defaultValue = x;
    x = (x + 1) % 3;
});

set_value.addEventListener("click", function () {
    textinput.value = "new value!";
});
</script>
<div>group 1
  <div><input type="radio"></div>
  <div><input type="radio" checked></div>
</div>
<div>group 2
  <div><input type="radio" name="a" checked></div>
  <div><input type="radio" name="a"></div>
</div>
</form>