HTML CSS examples for HTML Global Attribute:id
Use the id attribute to manipulate text with JavaScript:
<html> <body> <h1 id="myHeader">Hello World!</h1> <button onclick="displayResult()">Change text</button> <script> function displayResult() {<!--from www. j a v a 2 s . co m--> document.getElementById("myHeader").innerHTML = "Have a nice day!"; } </script> </body> </html>