Most of the effects on this page are adapted from scripts I found in online libraries.
My original unique scripts are collected at jsgenie scripts.
You might say I'm a JavaScript Genie, in love with the magic.
EXAMPLES OF JAVASCRIPT IN ACTION
What is JavaScript?
JavaScript is a "scripting language" that is embedded in web pages and downloaded along with the HTML source code. Originally named "LiveScript", it was developed by Brendan Eich at Netscape in 1995 to help integrate Java support in Navigator 2.0. Renamed Javascript as a marketing move, it is an entirely separate entity from the Java programming language. This continues to confuse people. Web designers enthusiastically implemented JavaScript to make their pages more dynamic and interactive.
Microsoft soon countered with it's own implementation, "JScript," for Internet Explorer. The introduction of CSS (Cascading Style Sheets) and DHTML extended the power of JavaScript, and also caused more cross-browser compatibility problems. There has been some progress towards a universal standard, but the same JavaScript code may be interpreted in different ways by Microsoft Internet Explorer and Netscape Navigator (as well as other browsers, such as Opera), because each browser continues to implement a slightly different DOM (Document Object Model).
The following HTML code plus JavaScripts
<html>
<head>
<title>Hello from netSperience</title>
<script language="javascript" type="text/javascript">
<!--
var name=""
function helloName(name){
document.write("hello from <b><i>"+name+"<\/i><\/b> !!")
}
//-->
</script>
</head>
<body>
<script language="javascript" type="text/javascript">
<!--
helloName("netSperience")
//-->
</script>
</body>
</html>
writes this text --» hello from netSperience !!
What can JavaScript do?
JavaScript extends the capabilities of HTML
JavaScript is a very light programming language with a very simple syntax, and many ready-made scripts are available for free in online libraries. As you can see from this page, almost anyone can start putting small "snippets" of code into their HTML documents!
JavaScript can make Web pages dynamic
Take for example, the HTML code: <h1>netSperience</h1> . A JavaScript statement like this: document.write("<h1>" + name + "</h1>") writes the variable (name) into the heading tag. The value of "name" could be changed by JavaScript. A script can "detect" the browser software that is being used (Internet Explorer, Netscape ... and those critical version numbers!) and direct the flow so that browser-specific code is loaded. A script can manipulate the HTML document's elements, such as colors, buttons, title and location bars, etc.
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 a link. You've seen images that change when you move the mouse cursor over them. JavaScript can also open, arrange, and close windows (you can thank JavaScript for a lot of annoying pop-up ads).
JavaScript can personalize the web page
"Cookies" can be used to store bits of information such as the viewer's name or preferences and retrieve them when the same person returns. Cookies are saved to the viewer's computer, and can only be retrieved by pages in the same server directory as the HTML document which created the cookie.
JavaScript can power-up forms
Form elements (eg. text input boxes) can be read and manipulated by JavaScript. Items on an order form can be totalled. JavaScript can be used to validate data in a form before it is submitted to a server. The script can check for completeness and appropriate entries. This function is particularly well suited to save the server from extra processing - and reduce frustration for the person sending the form. The Social Security script (to the right) searches a mini-database which is contained in the <HEAD> of this document; the number you enter isn't recorded or reported - but beware, anything you enter in a form could be retrieved without your knowledge!
Stupid JavaScript tricks
Some cruel JavaScript programmers have discovered ways to tweak browser features and annoy the viewer. The scripts can be quite simple, and infuriating. For example, a page can be set to reload every time you leave it. Or a script can insist that you click on a particular button. The BACK button on the browser can be disabled by manipulating the history property. A window can go crazy, jumping around and resizing itself. And the colors of the BG, TEXT, etc., can be changed rapidly making the page difficult to read (like my ColorShow). Some graphics designers are so paranoid about image stealing, they disable the "right click" in Windows to try to prevent saving the image file (of course, there are many other ways to steal it!) Some web designers are so worried about webbots gleaning their email addresses from their sites, they have JavaScript assemble all their "mailto:" tags from little pieces of text. I even saw one script in an online library which was designed to convince the viewer that the computer was infected with a dangerous virus (ha ha). More like April Fool's Day than Armageddon, if you encounter one of these "funny" scripts, it's just another one of the facets that keep the WWW whirling. Some of the most annoying scripts cause "things" (eyes, bouncing balls, UFO's) to follow your mouse cursor around. At first, they are amusing, but they become distracting, and there usually isn't any way to turn them off.
Try to
click on the money
to "steal" it (copy the image)
Is JavaScript safe ?
Before you panic and turn off JavaScript in your browser forever, I want to reassure you that JavaScript is safe. After all, it was developed by Netscape, and has been around long enough that most security problems have been addressed. JavaScript cannot write or erase files on your computer (except Cookies). Although the amount of browser info it can detect is impressive, it is anonymous (Netscape Navigator allows detection of your IP address, but most people get a different IP every time they log on to their ISP). JavaScript cannot transmit any personal information about you unless you enter it in a form. Presumably you want to send the information when you submit the form. So don't lose any sleep worrying about a silly little thing like JavaScript!
Don't miss jsgenie scripts a collection of my original and unique scripts!