Script :
<html> <body> <h1>Our First JS Code</h1> <script type="text/javascript"> document.write("<p>" + Date() + "</p>"); </script> </body> </html>
Output :
Precautions to be taken while using document.write :
- Avoid using document.write() in day to day life JavaScript code.
- It will overwrite entire HTML page if used inside function after page load.
- This is our first JS Script so its easy to use document.write().
Pingback: Java Script Statements | Learn Java Script