Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 76 - 2609_Logicode
P. 76

    Tick ( ) if you know this.
                           ▶   In HTML, you can use JavaScript in two ways: internally and externally.
                           ▶  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.

                       74   Premium Edition-VIII

| 71 72 73 74 75 76 77 78 79 80 81 |