1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-20 00:15:31 +00:00
elinks/test/ecmascript/element_getElementsByTagName.html
2022-12-21 15:47:41 +01:00

23 lines
494 B
HTML

<!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(0).outerHTML;
window.alert(x);
}
</script>
</body>
</html>