diff options
Diffstat (limited to 'framework/Web/Javascripts/tests/getElementsByClassName.html')
-rw-r--r-- | framework/Web/Javascripts/tests/getElementsByClassName.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/framework/Web/Javascripts/tests/getElementsByClassName.html b/framework/Web/Javascripts/tests/getElementsByClassName.html new file mode 100644 index 00000000..b764aac4 --- /dev/null +++ b/framework/Web/Javascripts/tests/getElementsByClassName.html @@ -0,0 +1,28 @@ +<html>
+<head>
+ <script type="text/javascript" src="../../base.js"></script>
+ <script type="text/javascript" src="../../dom.js"></script>
+ <script type="text/javascript">
+ function test() {
+ var elements = document.getElementsByClassName($('class-name').value);
+ for (var i = 0; i < elements.length; i++) elements[i] = elements[i].id;
+ alert(elements.join(', '));
+ return false;
+ }
+ </script>
+</head>
+<body>
+ <div id="a" class="foo">a: foo</div>
+ <div id="b" class="foo bar">b: foo, bar</div>
+ <div id="c" class="bar">c: bar</div>
+ <div id="d" class="bar baz">d: bar, baz</div>
+ <div id="e" class="baz">e: baz</div>
+ <div id="f" class="foo baz">f: foo, baz</div>
+
+ <fieldset>
+ <label for="class-name">Class name:</label>
+ <input id="class-name" type="text" value="foo" />
+ <button onclick="return test()">Find</button>
+ </fieldset>
+</body>
+</html>
|