1
0
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:
Witold Filipczyk 2022-12-21 15:33:07 +01:00
parent 216b6021f8
commit 7a1c315522

View 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>