Page 112 - CodePilot V5.0 C8
P. 112

RAPID RECALL                           Tick ( ) if you know this.



                      1.  In HTML, you can use JavaScript in two ways: internally and externally.

                      2.  A variable is a memory reference to a stored value.







                         INCLUDING HTML TAGS IN JAVASCRIPT


                  Including HTML tags  in JavaScript  means using JavaScript  to  change or add  content  on a
                  web page. With JavaScript, you can create new HTML elements like headings, paragraphs or
                  images and add them to the page while it’s running. This makes websites interactive, meaning

                  they can change without needing to reload. JavaScript can write HTML tags into the web page,
                  like using document.write() or creating new elements with document.createElement().
                  This way, you can easily update or change the content on the page, making the website more
                  exciting and interactive.


                     Code
                       4       Create a web page to demonstrate the inclusion of HTML tags in JavaScript.


                  <!DOCTYPE HTML>
                  <HTML>

                  <HEAD>
                  <TITLE>HTML Tags</TITLE>

                  </HEAD>
                  <BODY>

                  <SCRIPT>

                  document.write("<H1>Welcome to JavaScript</H1>")
                  document.write("<H2><I>Using HTML tags in JavaScript</I></H2>")

                  </SCRIPT>
                  </BODY>

                  </HTML>





                        The document.createElement() method in JavaScript dynamically creates an HTML element,
                                   allowing new elements to be added to the document during runtime.





                   110
                        CodePilot (V5.0)-VIII
   107   108   109   110   111   112   113   114   115   116   117