JavaScript

From Wikipedia, the free encyclopedia
Jump to: navigation, search

JavaScript is a scripting language for computers. It is often run in web browser applications to create dynamic content like message boxes popping up or a live clock. It is not related to and is different from the programming language Java.

Example[change]

The following script writes "Example" on the screen:

<script type="text/javascript">
function example()
{
    var ex = document.createTextNode('Example');
    document.body.appendChild(ex);
}
example();
 
/*
 * The code below does almost the same thing as the code above, 
 * but it shows "Example" in a popup box and is shorter.
 */
 
alert("Example");
</script>

The JavaScript is enclosed by <script> </script> tags, to tell that it is a script and not text.

Other pages[change]

Other websites[change]