Javascript DOM HTML Document write() Method write html text

Introduction

Write HTML elements with text directly to the HTML document:

document.write("<h1>Hello World!</h1><p>Have a nice day!</p>");

View in separate window

<!DOCTYPE html>
<html>
<body>

<script>
document.write("<h1>Hello World!</h1><p>Have a nice day!</p>");
</script>/*w w  w .ja v  a  2  s .com*/

</body>
</html>



PreviousNext

Related