JavaScript       ByDr. Ejaz Ahmed
Scripting Language Javascript• JavaScript was designed to add interactivity to HTML  pages• JavaScript is a scripting lang...
Are Java and JavaScript the same?• NO!• Java and JavaScript are two completely different  languages in both concept and de...
Introduction•   JavaScript was designed to add interactivity to HTML pages.•   JavaScript is a scripting language.•   Java...
How to use javascript?• The common way to use the javascript is as follows;• Define some HTML tag with ID attribute value ...
What can a JavaScript do?• JavaScript gives HTML designers a programming tool - HTML authors  are normally not programmers...
Ajax• AJAX = Asynchronous JavaScript and XML.• AJAX is not a new programming language, but a new way to  use existing stan...
How Ajax Works?
Web Servers•   jakarta-tomcat-5.0.28 (with jdk)•   Dot Net (.Net) Framwork•   IBM WebSphere•   ZendCore•   etc.
Getting Started with JavaScript         Event: onclick
Introducing document‘getElementById()’ method
Validation Through JavaScript
Example
Example …
Example – Data conversions and         Calculations
Example – Dialogue Box & Pop up            Window
Code - Dialogue Box & Pop up           Window
Example – Dialogue Box &      Calculations
Pop up window and Document           Write
HTML JavaScript Arrays
Java script202
Upcoming SlideShare
Loading in...5
×

Java script202

951

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
951
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Java script202

  1. 1. JavaScript ByDr. Ejaz Ahmed
  2. 2. Scripting Language Javascript• JavaScript was designed to add interactivity to HTML pages• JavaScript is a scripting language• 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)• Everyone can use JavaScript without purchasing a license
  3. 3. Are Java and JavaScript the same?• NO!• Java and JavaScript are two completely different languages in both concept and design!• Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.• JavaScript was invented by Brendan Eich at Netscape (with Navigator 2.0), and has appeared in all browsers since 1996.
  4. 4. Introduction• JavaScript was designed to add interactivity to HTML pages.• JavaScript is a scripting language.• JavaScript is usually embedded directly into HTML pages.• JavaScript is an interpreted language (means that scripts execute without preliminary compilation).• It is an event-driven language.• To insert a JavaScript into an HTML page, use the <script> tag.• Inside the <script> tag use the type attribute to define the scripting language.• The <script> and </script> tells where the JavaScript starts and ends. <script type="text/javascript">
  5. 5. How to use javascript?• The common way to use the javascript is as follows;• Define some HTML tag with ID attribute value given.• In that HTML tag add/call the function statement and bind it to some event on which you want to invoke the javascript function (event handler).• Write the said function (event handler) between <script> and </script> tags.• When the page downloads, your handler will be called on event you described within the HTML tag.
  6. 6. What can a JavaScript do?• JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages• JavaScript can put dynamic text into an HTML page - A JavaScript statement like this: document.write("<h1>" + name + "</h1>")• can write a variable text into an HTML page• JavaScript can react to events - A JavaScript can be set to execute when something happens, like when a page has finished loading or when a user clicks on an HTML element• JavaScript can read and write HTML elements - A JavaScript can read and change the content of an HTML element• JavaScript can be used to validate data - A JavaScript can be used to validate form data before it is submitted to a server. This saves the server from extra processing
  7. 7. Ajax• AJAX = Asynchronous JavaScript and XML.• AJAX is not a new programming language, but a new way to use existing standards.• AJAX is the art of exchanging data with a server, and update parts of a web page - without reloading the whole page.• AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.• Classic web pages, (which do not use AJAX) must reload the entire page if the content should change.• Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs.
  8. 8. How Ajax Works?
  9. 9. Web Servers• jakarta-tomcat-5.0.28 (with jdk)• Dot Net (.Net) Framwork• IBM WebSphere• ZendCore• etc.
  10. 10. Getting Started with JavaScript Event: onclick
  11. 11. Introducing document‘getElementById()’ method
  12. 12. Validation Through JavaScript
  13. 13. Example
  14. 14. Example …
  15. 15. Example – Data conversions and Calculations
  16. 16. Example – Dialogue Box & Pop up Window
  17. 17. Code - Dialogue Box & Pop up Window
  18. 18. Example – Dialogue Box & Calculations
  19. 19. Pop up window and Document Write
  20. 20. HTML JavaScript Arrays
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×