Javascript DOM HTML Element inner html change
<!DOCTYPE html> <html> <head> <title>Changing HTML Content</title> <script language="JavaScript"> function ChangeContent()/* w w w .j av a 2s . co m*/ { // Modify the <p> tag. document.getElementById("Change1").innerHTML = "Changed!"; // Modify the <input> tag. document.getElementById("btnChange").setAttribute("value", "Clicked"); } </script> </head> <body> <h1>Changing HTML Content</h1> <p id="Change1">Change Me</p> <input id="btnChange" type="button" value="Click Me" onclick="ChangeContent()" /> </body> </html>