2. It allows many actions to be performed like, setting the browser's preferences and receiving the request from the servers for the client computer.
3. The settings that are used gets saved on the client side on the features like actions buttons, appearance and printing.
4. It allows easy launching of an application on the client computer with interactive data to be communicated between the server and the client.
5. It allows reading and writing of files or directories on the client or server side.
6. It allows easy capturing of the data that is live streamed from the server to the client machine for retransmission.
7. It also allows to safe and secure the application from the outside world.
The language is used to create objects that are connected to page elements and other elements in a language. The separation allows the concept of development and effort to be shared with each factor.
What is the use of DOM?
DOM is also known as Document Object Model which is used to develop a model with documents or web pages containing objects like elements, links, etc.
These objects can be manipulated or certain actions like add, delete or change of an element can be performed using this document object model. Through this change in attributes can be done to get all the list of all the elements in the document.
The DOM model responds to API calls that result in documented level of DOM recommendation.
It is used to support additional behavior on the web page and use of API give an extensible advantage over other models existing. DOM codes are reused to meet the requirement of the real world and to make all the program interoperable.
The browser treat the written lines between the comment tag as normal lines and just thinking of the comment ignores it. Some browsers just treat the >!-- comment--> as a comment only and ignores whatever is written inside it.
Data entry validation : This tell that if the field of the form is filled out then during the processing of the server the client side can interact with it.
Dynamic HTML interactivity : It allows dynamic position of the data without using any other scripting language.
CGI prototyping : It allows more reduction of time to access the user interface before implementing the application of the CGI.
Window object : This is the topmost object in the hierarchy. It represent the content area of browser window that consists of HTML documents. Each frame is also a window that has some actions inside it.
Document object : This object gets loaded in a window and consists of objects of different kind in the model. It consists of the content that will be written in the script.
Form object : Form objects are used for more interaction with the users. It represents the form elements inside <FORM>...</FORM> tag.
- Object naming is used to create script references to objects while assigning names to every scriptable object in the HTML code. The browsers that are script compatible looks for the optional tags and attributes that enables the assigning of a unique name to each object. The example is :
<form name="dataEntry" method=get>
<input type="text" name="entry">
<frame src="info.html" name="main">
- The names act as a nametags through which the elements can be easily identified and easily located by the browsers. The references made for each object includes the object hierarchy from the top down. References are used to include names of each object that are coming in the window object.
The object naming conventions are easy way to loacte the objects and the linking between them can be done more comfortably.
- These are the functions which perform the dynamic interaction with the user. The first statement execute the element when pressed submit button to send a form to a server. These two statements are related to only the form. The scripts that are invoked will have the write of the document as well and will be written as :
document.write("Give the version " + navigator.appVersion)
document.write(" of <B>" + navigator.appName + " </B>." )
1. Define or initialize a variable that will be used in an object when executing the script
2. Assign a value to a property or variable so that user inputs can be taken according to the values that are defined in it.
3. Change the value of a property or variable to give more flexibility to the use of a scripting language.
4. Invoke an object's method to allow faster processing of the system
5. Invoke a function routine to allow the function to perform various activities so that the application can run at faster speed.
What is the function of Deferred scripts?
Deferred scripts are the scripts whose statements run as grouped together statements as a function. Function provides a definition of a block that a script statement consists of to run the statements that are in the <SCRIPT> tags after all the statements loaded in the browser.
Functions allow to see the user clearly the visiblity inside the <SCRIPT> tag. In this tag each function starts with function() and function name is written after it including the parentheses.
Once a function is loaded it becomes ready to run whenever there is a use of it. It is useful when a function gets used immediately after a page load.
The Window object uses an event handler that triggers the response to the user actions and the handler is onLoad.
What is the difference between Scripting and Programming?
- Scripting is easier to write than programming. As programming requires more hands on to the code and a language specification to write.
- Scripting consists of lots of tools to easily create an object model and run it using any browser, wheras programming doesn't have many tools to create an object model and it is not easy to use browser compatibility.
- Scriptting doesn't require lots of knowledge to be provided with and can be easily learnt, but to learn a programming language it requires lots of knowledge.
Dynamic component is a model that consists of many other sub-components that are based on dynamic theory only like:
The different components that are required in the functional model is :
1. First-class functions : Fuctions that are first class will have some objects whose properties and methods are given by using the methods like length() and call(). These methods can be given different varibles and passed by an argumnent.
2. Nested functions : These are the functions that are used in another function. It is created each time the outer function is invoked. If a function is used inside another then any constants, local variables and argument values, become part of the function object.
What is the difference between script type and the script language attributes?
- Script type is used to define the type through which the browser can understand the language and all the compatible browsers can execute the type according to themselves, whereas the script language attribute defines the content and its attributes that are used.
Load-time errors : These are the errors that come when loading a web page like using of improper syntax and the errors gets detected the moment user loads a page
Run-time errors : These are the errors that comes due to misuse of the language commands used inside the HTML document. This shows that it has loaded but the functionality is not properly integrated.
Logic errors : These are the errors that comes due to bad logic performed on a function that is having different operation but it is made to have logic differently.
- Math object has two constant : Math.PI and Math.E
- Math object has following functions :
Math.abs(val1); :It will give absolute value of val1.
Math.max(val1,val2) ; :This fuction will return maximum value from val1 and val2.
Math.random() ; :This function will return a random number between 0 and 1.
Math.floor(val1) ; :This function will returns decimal value of val1.
Can you explain about Screen object?
- The screen object can be used to retrieve the information about the visitor's screen.
- There are following properties of Screen objects :
avalHeight : This property returns the height of the screen excluding the windows taskbar.
availWidth : This property returns the width of the screen excluding the windows taskbar.
colorDepth : This property returns the bit depth of the color palette to display images.
height : This property returns the total height of the screen.
pixelDepth : This property returns the color resolution of the screen in bits per pixel.
width : This property returns the total width of the screen.
- If you use innerHTML the content is replaced everytime.
- We cannot use like 'appending to innerHTML'.
- Even if we use += like "innerHTML = innerHTML + 'html'" then also the old content is replaced by html.
- If we use innerHTML then the entire innerHTML content is re-parsed and build into elements. Therefore it's much slower.
- The innerHTML doesn't provide validation and therefore we can potentially insert invalid and broken HTML in the document and break it.
- The fifth edition of ECMAScript specification has introduced Script Mode.
- It throws errors for actions that are problematic and didn't throw an error before.
- It throws errors for the actions which are potentially unsafe.
- It shut downs the functions which are poorly thought out.
- To enable the strict mode we have to add the string literal "use strict" on the top of file or function as follow :
var v = "I am a strict mode function";
What is the difference between window.onload and onDocumentReady?
- The difference is that onDocumentReady is called after the DOM is loaded without waiting for all the contents to get loaded. While window.onload() function waits until the contents of page is loaded.
- Suppose there is very large image on a page, at that time onDocumentReady will wait until that image is loaded totally.
- So while using the window.onlaod() function the execution will be slow, but the onDocumentReady will not wait until the image is loaded.
- Textual description of error
- Address (URL) of page on which error occurred
- Number of line in which error occurred
If you want to invoke the default error handler of the browser, then your function should return (false) or vice versa.