|
JavaScript : Introduction JavaScript is a scripting language used to enable programmatic
access to objects within other applications. It is primarily used in the form of client-side
JavaScript for the development of dynamic websites.
JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha,
which was later renamed to LiveScript, and finally to JavaScript.
The primary use of JavaScript is to write functions that are embedded in or included
from HTML pages and interact with the Document Object Model (DOM) of the page. Some simple
examples of this usage are:
Opening or popping up a new window with programmatic control over the size, position,
and attributes of the new window (i.e. whether the menus, toolbars, etc. are visible).
Validation of web form input values to make sure that they will be accepted before
they are submitted to the server.
Example
<html>
<head>
<title>My Web Page</title>
<script type="text/javascript">
function showme(){
window.open("http://www.java-script.in");
}
</script>
</head>
<body>
<p>Click button to see new window.
<input type="button" onclick="showme()" value="Click Me" />
</body>
</html>
Changing images as the mouse cursor moves over them: This effect is often used to draw
the user's attention to important links displayed as graphical elements.
Because JavaScript code can run locally in a user's browser (rather than on a remote server)
it can respond to user actions quickly, making an application feel more responsive.
|