document.getElementById("p1").innerHTML = "New text!";
<html> <body> <p id="p1">Hello World!</p> <script> document.getElementById("p1").innerHTML = "New text!"; </script> </body> </html>