Saturday, November 1, 2008

java web pages

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.
* 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. Furthermore, JavaScript code can detect user actions which HTML alone cannot, such as individual keystrokes. Applications such as Gmail take advantage of this: much of the user-interface logic is written in JavaScript, and JavaScript dispatches requests for information (such as the content of an e-mail message) to the server. The wider trend of Ajax programming similarly exploits this strength.

A JavaScript engine (also known as JavaScript interpreter or JavaScript implementation) is an interpreter that interprets JavaScript source code and executes the script accordingly. The first ever JavaScript engine was created by Brendan Eich at Netscape Communications Corporation, for the Netscape Navigator web browser. The engine, code-named SpiderMonkey, is implemented in C. It has since been updated (in JavaScript 1.5) to conform to ECMA-262 Edition 3. The Rhino engine, created primarily by Norris Boyd (also at Netscape) is a JavaScript implementation in Java. Rhino, like SpiderMonkey, is ECMA-262 Edition 3 compliant.

The most common host environment for JavaScript is by far a web browser. Web browsers typically use the public API to create "host objects" responsible for reflecting the DOM into JavaScript. The web server is another common application of the engine. A JavaScript webserver would expose host objects representing an HTTP request and response objects, which a JavaScript program could then manipulate to dynamically generate web pages.

A minimal example of a web page containing JavaScript (using HTML 4.01 syntax) would be:

"http://www.w3.org/TR/html4/strict.dtd">

simple page





java Features

Structured programming

JavaScript supports all the structured programming syntax in C (e.g., if statements, while loops, switch statements, etc.). One partial exception is scoping: C-style block-level scoping is not supported. JavaScript 1.7, however, supports block-level scoping with the let keyword. Like C, JavaScript makes a distinction between expressions and statements.

[edit] Dynamic programming

dynamic typing
As in most scripting languages, types are associated with values, not variables. For example, a variable x could be bound to a number, then later rebound to a string. JavaScript supports various ways to test the type of an object, including duck typing.[8]
objects as associative arrays
JavaScript is almost entirely object-based. Objects are associative arrays, augmented with prototypes (see below). Object property names are associative array keys: obj.x = 10 and obj["x"] = 10 are equivalent, the dot notation being merely syntactic sugar. Properties and their values can be added, changed, or deleted at run-time. The properties of an object can also be enumerated via a for...in loop.
run-time evaluation
JavaScript includes an eval function that can execute statements provided as strings at run-time.

[edit] Functional programming

first-class functions
Functions are first-class; they are objects themselves. As such, they have properties and can be passed around and interacted with like any other object.
inner functions and closures
Inner functions (functions defined within other functions) are created each time the outer function is invoked, and variables of the outer functions for that invocation continue to exist as long as the inner functions still exist, even after that invocation is finished (e.g. if the inner function was returned, it still has access to the outer function's variables) — this is the mechanism behind closures within JavaScript.

[edit] Prototype-based

prototypes
JavaScript uses prototypes instead of classes for defining object properties, including methods, and inheritance. It is possible to simulate many class-based features with prototypes in JavaScript.
functions as object constructors
Functions double as object constructors along with their typical role. Prefixing a function call with new creates a new object and calls that function with its local this keyword bound to that object for that invocation. The function's prototype property determines the new object's prototype.
functions as methods
Unlike many object-oriented languages, there is no distinction between a function definition and a method definition. Rather, the distinction occurs during function calling; a function can be called as a method. When a function is invoked as a method of an object, the function's local this keyword is bound to that object for that invocation.

java history

JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, which was later renamed to LiveScript, and finally to JavaScript. The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December 1995. The naming has caused confusion, giving the impression that the language is a spin-off of Java, and it has been characterized by many as a marketing ploy by Netscape to give JavaScript the cachet of what was then the hot new web-programming language.[5][6]

Microsoft named its dialect of the language JScript to avoid trademark issues. JScript was first supported in Internet Explorer version 3.0, released in August 1996, and it included Y2K-compliant date functions, unlike those based on java.util.Date in JavaScript at the time. The dialects are perceived to be so similar that the terms "JavaScript" and "JScript" are often used interchangeably (including in this article). Microsoft, however, notes dozens of ways in which JScript is not ECMA compliant.

Netscape submitted JavaScript to Ecma International for standardization resulting in the standardized version named ECMAScript.[7

java script

JavaScript is a scripting language most often used for client-side web development. It was the originating dialect of the ECMAScript standard. It is a dynamic, weakly typed, prototype-based language with first-class functions. JavaScript was influenced by many languages and was designed to look like Java, but be easier for non-programmers to work with.[1][2]

Although best known for its use in websites (as client-side JavaScript), JavaScript is also used to enable scripting access to objects embedded in other applications (see below).

JavaScript, despite the name, is essentially unrelated to the Java programming language, although both have the common C syntax, and JavaScript copies many Java names and naming conventions. The language was originally named "LiveScript" but was renamed in a co-marketing deal between Netscape and Sun, in exchange for Netscape bundling Sun's Java runtime with their then-dominant browser. The key design principles within JavaScript are inherited from the Self and Scheme programming languages.[3]

"JavaScript" is a trademark of Sun Microsystems. It was used under license for technology invented and implemented by Netscape Communications and current entities such as the Mozilla Foundation.[4]

switch java





This JavaScript will generate a different greeting based on what day it is. Note that Sunday=0, Monday=1, Tuesday=2, etc.







random link java








else statement java







This example demonstrates the If...Else statement.




If the time on your browser is less than 10,
you will get a "Good morning" greeting.
Otherwise you will get a "Good day" greeting.






if statement







This example demonstrates the If statement.




If the time on your browser is less than 10,
you will get a "Good morning" greeting.





This example demonstrates the If statement.

If the time on your browser is less than 10, you will get a "Good morning" greeting.

Latest Additions to The JavaScript Source

Tools: TinyMCE - A platform independent Web-based WYSIWYG editor. Convert textarea fields or other HTML elements to editor instances. Very easy to integrate into other content management systems.

Image Effects: Reflection.js - Add reflections to selected images on your Web pages. Vary the reflection height and opacity. Very easy to use and completely unobtrusive. Works well with logos, icons and dynamic image content such as forum avatars. Degrades nicely in older browsers.

Tutorials: Creating a Virtual jQuery Keyboard - This tutorial explains how to implement a simple virtual keyboard with some help from jQuery. An excellent technique for use when security is important.

Snippets: parseUri - This function splits any well-formed URI into its parts (all are optional). All parts are split with a single regex using backreferences, and all groupings which don't contain complete URI parts are non-capturing.

Tools: JSMin - This is a filter which removes comments and unnecessary whitespace from JavaScript files. It typically reduces filesize by half, resulting in faster downloads.

More Additions: We add new scripts and tutorials on a regular basis. Be sure you didn't miss any of the most recent additions.

Wednesday, July 30, 2008

java

Java (Indonesian: Jawa) is an island of Indonesia and the site of its capital city, Jakarta. Once the centre of powerful Hindu kingdoms and the core of the colonial Dutch East Indies, Java now plays a dominant role in the economic and political life of Indonesia. Housing a population of 130 million in 2006[1], it is the most populous island in the world, ahead of Honshū, the main island of Japan. Java is also one of the most densely populated regions on Earth.

Formed mostly as the result of volcanic events, Java is the 13th largest island in the world and the fifth largest island in Indonesia. A chain of volcanic mountains forms an east-west spine along the island. It has three main languages, and most residents are bilingual, with Indonesian as their second language. While the majority of Javanese are Muslim, Java has a diverse mixture of religious beliefs and cultures.Java is known for several important finds of early hominid specimens.[8] In particular, the 1891 discovery of cranial fossil remains commonly known as "Java man" (now designated as Trinil 2, after the Trinil site on the Bengawan Solo River) is notable as the first early hominid specimen found outside Europe. In the following course of human history, several kingdoms existed on Java. The first kingdoms ruled there were Indianized kingdoms like Tarumanagara and Sunda, influenced by Hinduism and Buddhism. Sailendra (8–9th century), Mataram (752–1045), Kediri (1045–1221), Singhasari (1222–1292) and Majapahit (1293–1500) were among them, leaving evidence of their existence throughout Java. Among many other temples in Java, Borobudur (a Buddhist temple) and Prambanan (a Hindu temple) are the most famous relics of the old Javanese kingdoms, both of which are listed in the UNESCO world heritage site.

Islam spread into the Indonesian archipelago, including Java, in the thirteenth century. At the time, the Wali Songo (the "nine ambassadors") were the most prominent Muslim evangelists in the region. The spread of Islam (1200–1600) took place first in coastal cities, which developed into Muslim states, such as Sultanate of Demak (1475–1518) and Mataram Sultanate (1500s–1700s).
Early 18th century Dutch map; only the north coastal ports of Java are well known.
Early 18th century Dutch map; only the north coastal ports of Java are well known.

In 1602, the Dutch East India Company (VOC) arrived in the archipelago and subsequently occupied and maintained control of trade and power for more than 300 years. VOC established Batavia (present-day Jakarta) on the northern coast of Java as its trading center and administrative headquarters. Other north coastal cities, such as Semarang and Surabaya, developed into major trading harbors. The Dutch also developed Bandung in the inner mountainous region of West Java to which they had planned to move the capital from Batavia.

Java was briefly governed by the British East India Company (1811–1816) under the appointed Lieutenant Governor General Sir Thomas Stamford Raffles, while Holland was occupied by France during the Napoleonic wars. During Raffles' administration he introduced partial self-government, a land-tenure system, and abolished the slave trade. Besides that, Raffles developed a strong interest in Javanese culture and restored several temples, including Borobudur. Raffles also wrote the famous book of "The History of Java", the first book that described Java's civilization and culture to the outside world.

After Indonesian independence in 1945 Jakarta remained as the capital, while Java itself has grown into the most crowded area in Indonesia. Although parts of rural Java are still underdeveloped, the urban areas are the wealthiest and most developed parts of Indonesia.