Javascript examples for DOM HTML Element:Paragraph
Set text for <p>
<html> <head></head> <body> <h1>My Web Page</h1> <p id="demo">A Paragraph.</p> <p id="myDIV">A DIV.</p> <button type="button" onclick="myFunction()">Try it</button> <script> function myFunction()//from www . jav a 2s . co m { document.getElementById("demo").innerHTML="Hello Dolly"; document.getElementById("myDIV").innerHTML="How are you?"; } </script> </body> </html>