File: select-onchange-after-js.html

package info (click to toggle)
qtwebkit 2.3.4.dfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 290,116 kB
  • ctags: 272,544
  • sloc: cpp: 1,417,496; python: 85,048; ansic: 39,353; perl: 38,858; ruby: 10,313; objc: 9,505; xml: 8,679; asm: 3,864; yacc: 2,458; sh: 1,237; lex: 813; makefile: 592; java: 228; php: 79
file content (47 lines) | stat: -rw-r--r-- 1,810 bytes parent folder | download | duplicates (16)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
    <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11402">bug 11402</a> and 
    <a href="http://bugs.webkit.org/show_bug.cgi?id=12701">bug 12701</a>:
    An onChange event should fire when the first item is not the default, and
    after changing the value via JavaScript.</p>
    <p>After following the steps below, both selects should display "SUCCESS".</p>

    <form action="" method="post" name="areaform" id="areaform">
        <select name="selectitem" onChange="onChange1(this)">
            <option value="1">Please change this to another value</option>
            <option value="2">(to this one)</option>
        </select>
    </form>
    <form action="" method="post" name="areaform2" id="areaform2">
        <select name="selectitem2" onChange="onChange2(this)">
            <option value="1">(to this one)</option>
            <option value="2" selected>Please change this to another value</option>
        </select>
    </form>

    <script>
        function onChange1(sel) {
            if (sel.secondTry) {
                sel.options[1].text='SUCCESS';
            } else {
                sel.options[0].text='Please change this to another value once again';
                sel.value = '1';
                sel.secondTry = 1;
            }
        }
        
        function onChange2(sel) {
            if (sel.secondTry) {
                sel.options[0].text='SUCCESS';
            } else {
                sel.options[1].text='Please change this to another value once again';
                document.forms.areaform2.selectitem2.options[1].selected = true;
                sel.secondTry = 1;
            }
        }
    </script>

</body>
</html>