How to Do Java Scripting
JavaScript is a scripting language that allows you to add dynamic features to your Web pages. It is an interpreted language, which means it does not have to be compiled to be used. The code is interpreted when the Web page is loaded. It is used to validate data, detect the type of browser that is being used, create cookies and react to events such as when a menu option is chosen. JavaScript is interpreted by the browser, so it does not need to be added to the server that is hosting the Web page.
Difficulty: Easy
Instructions
Things You'll Need:
· Any text editor
1. Step 1
Open a blank text document in any text editor. This is where you will type your JavaScript code and your HTML document.
2. Step 2
Place the JavaScript code between the <script> and </script> tags. The opening tag must also have the "type" attribute set to "javascript." For example, the opening tag would read "<script type="text/javascript">." The script can go anywhere in the document. Functions and methods are usually found in the "<head>" section. This ensures that the script is loaded before the rest of the page. Scripts that print something to the screen are contained within the "<body>" section of the document. JavaScript applications can be saved as an external document with the ".js" extension. External files are not placed within the "<script>" tags.
3. Step 3
Type the sequence of JavaScript commands between the opening and closing script tags. JavaScript code is case-sensitive, so if you name a variable "Var" you cannot access it by referencing "var." Although it is optional, most programmers end each statement with a semicolon.
4. Step 4
Call the functions created within the HTML document. For example, you can call a function within a form with the "onChange" attribute in the <form> tag.
5. Step 5
Save the file. If the JavaScript code is contained within the HTML document, save the file with the ".html" extension. If the JavaScript code is contained in an external file, use the ".js" extension.
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
0 comments:
Post a Comment