The cursor can set to wait in JavaScript by using the property ?cursor? property The following example illustrates the usage windowdocumentbodystylecursor = "wait";
Correct Answer: The elements of JavaScript are accessed by their names By default the browser is accessed by the element ?windows? and the page by ?document? The corresponding element has user defined names for forms and its elements For example var pwd = windowsdocumentfrmLoginpasswordvalue; assigns the value of the password field of the form fromLogin in the current document, where password is the name of the element and frmLogin is the name of the form Like wise any form element is accessed
2. Where are cookies actually stored on the hard disk?
Correct Answer: The storage of cookies on the hard disk depends on OS and the browser The Netscape navigator on Windows, the file cookiestxt contains all the cookies The path is : c:\Program Files\Netscape\Users\username\cookiestxt The Internet Explorer stores the cookies on a file by name username@websitetxt is c:\Windows\Cookies\username@Websitetxt
3. What is the difference between Client side JavaScript and Server side JavaScript.
Correct Answer: Client side java script comprises the basic language and predefined objects which are relevant to running java script in a browser The client side java script is embedded directly by in the HTML pages This script is interpreted by the browser at run time Server side java script also resembles like client side java script It has relevant java script which is to run in a server The server side java scripts are deployed only after compilation
Correct Answer: JavaScript: - JavaScript is a scripting language developed by Netscape Communications - The Netscape Navigator interprets JavaScript embedded into Web pages - JavaScript is used for developing web applications - It is not dependent on Sun Microsystem's Java language JScript: - Microsoft JScript is an open implementation of Netscape's JavaScript - JScript is a scripting language designed to create active online content ActiveX controls, Java programs, etc can be linked and automated in the web pages using JScript
5. What are the advantages of the external over inline style methods?
Correct Answer: - External Style Sheets are useful as it keeps the style and content separately and doesn?t allow it to mix with each other It can control the styles for multiple documents, whereas inline style mixes the content with the style and make the code messier - External style sheet allows the creation of various classes in a structured way, whereas inline style sheet can?t create or control class elements - External style sheet can use selector and grouping methods to apply styles, whereas inline styles can?t use selector and grouping methods
6. What is decodeURI(), encodeURI() in JavaScript?
Correct Answer: To send the characters that can not be specified in a URL should be converted into their equivalent hex encoding To perform this task the methods encodeURI() and decodeURI() are used For example, the following code snippet performs the encoding of URL:
7. What are windows object and navigator object in JavaScript?
Correct Answer: Windows object is top level object in Java script It contains several other objects such as, document, history, location, name, menu bar etc, in itself Window object is the global object for Java script that is written at client-side Information pertaining to the client browser and system is returned by the navigator object of JavaScript Navigator object is the top level object for all users
Correct Answer: NaN stands for ?not-a-number? The function isNaN determines the argument or the value is a NaN The function returns true if the argument is not a number, otherwise returns false
Correct Answer: Files can be read and written by using java script functions ? fopen(),fread() and fwrite() The function fopen() takes two parameters ? 1 Path and 2 Mode (0 for reading and 3 for writing) The fopen() function returns -1, if the file is successfully opened Ex: file=fopen(getScriptPath(),0); The function fread() is used for reading the file content Ex: str = fread(file,flength(file)); The function fwrite() is used to write the contents to the file Ex(): file = fopen("c:\MyFiletxt", 3);// opens the file for writing fwrite(file, str);// str is the content that is to be written into the file
Correct Answer: Arrays are created by using new Array() in Java Script For example : var employees = new Array(); The elements to this array is assigned as follows : employees[0] = "Kumar" employees[1] = "Fedrick"