Page 162 - CITS - CSA - TP (Volume 1) - Hindi
P. 162

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS




                 console.log(person2.fullName()); // Output: Jane Smith
                 </script>

                 </body>
                 </html>

              3   ो ाम को .html फ़ाइल के   प म  सेव कर
              4  वेब  ाउज़र से html फ़ाइल ओपन कर
              5   ाउज़र कं सोल टैब पर जाएँ  और आउटपुट की पुि  कर ।






















           टा  2: डॉ ूम ट ऑ े  मॉडल का उपयोग करना
           1  टे  एिडटर ओपन कर

           2  िन िल खत कोड िलख

              <html >
              <head>

              <title>DOM Example</title>
              </head>
              <body>

              <h1 id=”heading”>DOM Example</h1>
              <p id=”paragraph”>This is a paragraph.</p>
              <button onclick=”changeColor()”>Change Color</button>

              <script>
              // Function to change the color of the heading

              function changeColor() {
              var heading = document.getElementById(‘heading );
              heading.style.color = ‘blue ;
              }

              </script>
              </body>

              </html>



                                                           146

                                      CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 40
   157   158   159   160   161   162   163   164   165   166   167