CodeLab
Tutorials For Everyone
Run
<!DOCTYPE html> <html> <head> <title>JavaScript document.write() Method Tutorial - TutsInsider</title> <style> .main{ padding: 10px; } .main-heading{ background: #333333; color: #ffffff; padding: 20px; } .main-paragraph{ margin-top: -20px; padding: 20px; box-shadow: inset 0 0 3px 0 #2a73cc; } .main-button{ padding: 5px 10px; border: none; border-radius: 5px; background: #333333; color: #ffffff; box-shadow: 0 0 3px 0 #333333; cursor: pointer; } </style> </head> <body> <div class="main"> <h2 class="main-heading">What is JavaScript document.write() Method?</h2> <div class="main-paragraph">The JavaScript document.wrtie() method is used to print data on the screen. Do not use this method after all the elements of the web page are loaded, as it will rewrite the whole content and replace it with the content of the method.</div> </div> <script> var week_num = 12; document.write("<strong>Learning JavaScript is an easy task, and one can learn JS in "+ week_num+" weeks.</strong>"); </script> </body> </html>