文档介绍:Web Programming
1 of 43
JAVA SCRIPT
Java Script
Web Programming
2 of 43
What is JavaScript ?
JavaScript was designed to add interactivity to HTML pages
JavaScript is a scripting language (a scripting language is a lightweight programming language)
A JavaScript consists of lines of puter code
A JavaScript is usually embedded directly into HTML pages
JavaScript is an interpreted language (means that scripts execute without pilation)
Everyone can use JavaScript without purchasing a license
Web Programming
3 of 43
It supports many features of structured programming languages like C.
Java Script is Case Sensitive.
It has some built in objects like Document, Window, Date etc.
It can be included either in <head> or <body>
JAVA SCRIPT
Web Programming
4 of 43
Are Java and JavaScript the Same?
NO!
Java and JavaScript are pletely different languages in both concept and design!
Java (developed by Sun Microsystems) is a powerful and much plex programming language - in the same category as C and C++.
Web Programming
5 of 43
Differences
Java
Object Oriented
Strongly Typed
Supports Static & Dynamic binding
Availability of Classes & Packages
JavaScript
Object Based
Loosely Typed
Supports only Dynamic binding
Non availability of Classes & Packages
Web Programming
6 of 43
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: ("<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 t