How to use the write method?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

How to use the write method?

Rating:

The write method belongs to the document object. This method can be used to insert a text dynamically. It can also be used to create a Web page dynamically.

The following are the ways to insert text and create Web pages dynamically:

  • To insert text dynamically

    document.write("This is my first Web page.")

    The following image will show the output:



  • To create a Web page dynamically

    var content="<html>"
    content+="<body bgcolor='cyan' text='red'>"
    content+="<h1>"
    content+="Web page"
    content+="</h1>"
    content+="<p>"
    content+="The Web pages can be viewed through a Web browser."
    content+="<br>"
    content+="The Web pages can be created by Hypertext Markup Language (HTML)."
    content+="</body>"
    content+="</html>"


  • The following image will display the output of the following program:



Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.