fh = fopen(getScriptPath(), 0);
DOM stands for Document Object Model and is responsible for how various objects in a document interact with each other. DOM is required for developing web pages, which includes objects like paragraph, links, etc. These objects can be operated to include actions like add or delete. DOM is also required to add extra capabilities to a web page. On top of that, the use of API gives an advantage over other existing models.
Events are the actions that result from activities, such as clicking a link or filling a form, by the user. An event handler is required to manage proper execution of all these events. Event handlers are an extra attribute of the object. This attribute includes event’s name and the action taken if the event takes place.
By default, the parsing of the HTML code, during page loading, is paused until the script has not stopped executing. It means, if the server is slow or the script is particularly heavy, then the webpage is displayed with a delay. While using Deferred, scripts delays execution of the script till the time HTML parser is running. This reduces the loading time of web pages and they get displayed faster.
Nested functions: The functions, which are defined inside other functions, are called Nested functions. They are called ‘everytime’ the main function is invoked.
• Load-time errors: The errors shown at the time of the page loading are counted under Load-time errors. These errors are encountered by the use of improper syntax, and thus are detected while the page is getting loaded.
• Run-time errors: This is the error that comes up while the program is running. It is caused by illegal operations, for example, division of a number by zero, or trying to access a non-existent area of the memory.
• Logic errors: It is caused by the use of syntactically correct code, which does not fulfill the required task. For example, an infinite loop.
117. What are Screen objects?
Screen objects are used to read the information from the client’s screen. The properties of screen objects are –
• AvalHeight: Gives the height of client’s screen
• AvailWidth: Gives the width of client’s screen.
• ColorDepth: Gives the bit depth of images on the client’s screen
• Height: Gives the total height of the client’s screen, including the taskbar
• Width: Gives the total width of the client’s screen, including the taskbar
118. Explain the unshift() method ?
This method is functional at the starting of the array, unlike the push(). It adds the desired number of elements to the top of an array.
For example –
var name = [ “john” ];
name.unshift( “charlie” );
name.unshift( “joseph”, “Jane” );
The output is shown below:
[” Jane “, ” joseph “, ” charlie “, ” john “]
119. Define unescape() and escape() functions?
The escape () function is responsible for coding a string so as to make the transfer of the information from one computer to the other, across a network.
document.write(escape(“Hello? How are you!”));
The unescape() function is very important as it decodes the coded string.
It works in the following way. For example:
Output: Hello? How are you!
120. What are the decodeURI() and encodeURI()?
EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal.
var uri=”my test.asp?name=ståle&car=saab”;