Expert Developer JavaScript Question:
Explain the process of document loading in JavaScript?
Answer:
When a document loads that means it is getting ready for the execution on the system. The document loads in the browser when there is a running of a document on the system. The applicaiton allows the JavaScript to look for all the properties that is given to the object and include all the property values that are used in the content that is being rendered for the page about to load. It is always a good practice to include the content in <SCRIPT> tags and statements in the Body portion of the document. This way the application gets loaded immediately.
<HTML>
<HEAD>
<TITLE>Immediate loading</TITLE>
</HEAD>
<BODY>
<H1>JavaScript used</H1>
<HR>
<SCRIPT LANGUAGE="Text/JavaScript">
<!-- Comments are used to hide from old browsers
document.write("Give the version " + navigator.appVersion)
document.write(" of <B>" + navigator.appName + "</B>.")
// end of the comment section -->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Immediate loading</TITLE>
</HEAD>
<BODY>
<H1>JavaScript used</H1>
<HR>
<SCRIPT LANGUAGE="Text/JavaScript">
<!-- Comments are used to hide from old browsers
document.write("Give the version " + navigator.appVersion)
document.write(" of <B>" + navigator.appName + "</B>.")
// end of the comment section -->
</SCRIPT>
</BODY>
</HTML>
Previous Question | Next Question |
What are the methods involved in JavaScript? | What are the different functional component in JavaScript? |