Write a program to exaplain the deferred scripts using event handlers in JavaScript?
Submitted by: AdministratorEvent handler allows a trigger to be generated when a user action takes place like clicking a button, clicking on images, etc. OnLoad is an event handlers that handles all of the page's components that includes images, Java applets, and embedded multimedia to laod it in browser. The event handlers are mostly used in <BODY> tag. Event handler is also used to run several internal script statements such that it is better to use statements in a function definition and event handler invoking the function. The code below shows onLoad event handler triggers the done() function. The function consists of an alert box that gets displayed.
<HTML>
<HEAD>
<TITLE>Event_handler</TITLE>
<SCRIPT LANGUAGE="Text/JavaScript">
<!--
function done()
{
alert("The page has finished loading.")
}
// -->
</SCRIPT>
</HEAD>
<BODY Event_handler="done()">
</BODY>
</HTML>
Submitted by:
<HTML>
<HEAD>
<TITLE>Event_handler</TITLE>
<SCRIPT LANGUAGE="Text/JavaScript">
<!--
function done()
{
alert("The page has finished loading.")
}
// -->
</SCRIPT>
</HEAD>
<BODY Event_handler="done()">
</BODY>
</HTML>
Submitted by:
Read Online Expert Developer JavaScript Job Interview Questions And Answers
Top Expert Developer JavaScript Questions
☺ | Mention what is the disadvantage of using innerHTML in JavaScript? |
☺ | Which keyword is used to print the text in the screen? |
☺ | Why it is not advised to use innerHTML in JavaScript? |
☺ | Explain the concept of unobtrusive JavaScript? |
☺ | How are JavaScript and ECMA Script related? |
Top Scripting language Categories
☺ | AngularJS Interview Questions. |
☺ | Ext-JS Interview Questions. |
☺ | Dojo Interview Questions. |
☺ | Expert Developer JavaScript Interview Questions. |
☺ | SWFObject Interview Questions. |