JavaScript Tutorial : Flexibility of using JavaScript anywhere in a HTML document. - JavaScript Part 2

 The flexibility of using JavaScript anywhere in an HTML document.

1→ script in the head section.

2→ script in the body section.

3→ script in both head and body sections.

{getToc} $title={Table of Contents}

JavaScript Introduction Part 1: Checkout

Example 1 :

<html> 
 <head> 
     <script> 
         document.write("this is inside head"); 
     </script> 
  <body> 
  </body> 
 </head> 
</html>

Output

this is inside head

Example 2: 

 <html> 
 <head>
  <body>
    <script> 
         document.write("this is inside body"); 
    </script> 
   </body> 
  </head> 
</html>

Output

this is inside the body

Example 3 :

<html> 
 <head> 
  <script> 
    document.write("this is inside head"); 
  </script> 
 </head>
 <body> 
  <script> 
     document.write("this is inside body"); 
  </script> 
 </body>
</html>

Output

this is inside head 

this is inside the body

JavaScript Introduction Part 1: Checkout

Sharecodepoint

Sharecodepoint is the junction where every essential thing is shared for college students in the well-defined packets of codes. We are focused on providing you the best material package like Question papers, MCQ'S, and one NIGHT STUDY MATERIAL. facebook twitter youtube instagram

Post a Comment

Previous Post Next Post

Contact Form