1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-02 02:15:28 +00:00
elinks/test/ecmascript/element_getElementsByTagName.html

23 lines
494 B
HTML
Raw Normal View History

<!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() {
2022-12-21 14:47:41 +00:00
var x = document.getElementById('body').getElementsByTagName("P").item(0).outerHTML;
window.alert(x);
}
</script>
</body>
</html>