mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-02 08:57:19 -04:00
[js] test case for getElementsByTagName
This commit is contained in:
parent
216b6021f8
commit
7a1c315522
22
test/ecmascript/element_getElementsByTagName.html
Normal file
22
test/ecmascript/element_getElementsByTagName.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body id="body">
|
||||||
|
|
||||||
|
First Name: <input name="fname" type="text" value="Michael"><br>
|
||||||
|
First Name: <input name="fname" type="text" value="Doug">
|
||||||
|
|
||||||
|
<p>Click the button to get the tag name of the first element in the body that has tag P.</p>
|
||||||
|
|
||||||
|
<button onclick="myFunction()">Try it</button>
|
||||||
|
|
||||||
|
<p id="demo"></p>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function myFunction() {
|
||||||
|
var x = document.getElementById('body').getElementsByTagName("P").item(1).outerHTML;
|
||||||
|
window.alert(x);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user