Please login to start chat

ICT Solutions 24 Jun 2022, 11:52:53
Category : JavaScript Tutorials

getElementsByTagName (HTML DOM Document)

<!DOCTYPE html>
<html>
<head>
<title>JS Code Testing</title>
<style>
</style>
</head>
<body>
<ol>
<li>Example_1</li>
<li>Example_2</li>
<li>Example_3</li>
</ol>
<button onclick = "jsFun()">Red</button>
<script>
function jsFun(){
var i;
var x = document.getElementsByTagName("LI");
for(i = 0; i < x.length; i++){
x[i].style.color = "red";
}
}
</script>
</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application