blob: b764aac4425561de444c406bb10509754ae3c0f4 (
plain)
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
|
<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>
|