Javascript

1,573 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,573
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Javascript

  1. 1. Javascript * JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari. * JavaScript was designed to add interactivity to HTML pages * A scripting language is a lightweight programming language * JavaScript is usually embedded directly into HTML pages * JavaScript is an interpreted language (means that scripts execute without preliminary compilation)
  2. 2. Uses * JavaScript gives HTML designers a programming tool. * JavaScript can put dynamic text into an HTML page. * JavaScript can react to events. * JavaScript can read and write HTML elements. * JavaScript can be used to validate data. * JavaScript can be used to detect the visitor's browser. * JavaScript can be used to create cookies.
  3. 3. Javascript Statements * Javascript is a sequence of statements to be executed by the browser. * A JavaScript statement is a command to a browser. The purpose of the command is to tell the browser what to do. * This JavaScript statement tells the browser to write "Hello Dolly" to the web page: document.write("Hello Dolly");
  4. 4. HTML tags in javascript The example below shows how to add HTML tags to the JavaScript: <html> <body> <script type=&quot;text/javascript&quot;> document.write(&quot;<h1>Hello World!</h1>&quot;); </script> </body> </html> The document.write command is a standard JavaScript command for writing output to a page.
  5. 5. Javascript Comments Comments can be added to explain the JavaScript, or to make the code more readable. Example for comments: <script type=&quot;text/javascript&quot;> // Write a heading document.write(&quot;<h1>This is a heading</h1>&quot;); // Write two paragraphs: document.write(&quot;<p>This is a paragraph.</p>&quot;); document.write(&quot;<p>This is another paragraph.</p>&quot;); </script>
  6. 6. Advantages * Advantages include Cross-browser support, validating data on the client, and being able to create more sophisticated user interfaces. * JavaScript is an excellent solution to implement when validating input forms on the client side. * This means that if a user forgets to enter his name in a form for instance a JavaScript validation function can popup a message to let him know about the omission. * JavaScript effects are also much faster to download than some other front-end technologies like Flash and Java applets.

×