script defer - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:script

Introduction

Deferring Execution of a Script

The Statement Contained in the simple2.js Script File

document.getElementById("myId").innerText = "Oracle";

Using a script Element with the defer Attribute

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <script defer src="simple2.js"></script> 
   </head> 
   <body> 
      <p>
          I like 
         <code id="myId">HTML</code>
          and CSS. <!--from   w w w  . ja  v  a2  s.c o m-->
      </p> 
      <a href="http://java2s.com">Visit java2s.com</a> 
      <a href="page2.html">Page 2</a>  
   </body>
</html>

It has the save effect as the following.

Demo Code

ResultView the demo in separate window

<!DOCTYPE HTML>
<html>
    <head>
    </head>
    <body>
        <p>
            I like <code id="myId">HTML</code> and CSS.
        </p>
        <a href="http://java2s.com">Visit java2s.com</a>
        <a href="page2.html">Page 2</a>
        <script src="simple2.js"></script>
          </body>
      </html>

Related Tutorials