Enigman's Javascript Samples


Menu
Enigmans' Home Page
About me
Australia
 • Australia FAQ
 • Australian Currency
 • The Australian People
 • Australian Slang
 • Careers in Australia
Latin Sayings
Cool Links
HTML Stuff
Internet Security
Javascript Stuff
Java Stuff
Contact Enigman!
What's New?
Acknowledgements
Give Feedback
Site Map
Welcome to my Javascript Samples Page. This page contains links to Javascript examples that I have developed either for my own use or others. You may freely use any of these scripts on your own pages. This page is a little bare at the moment as I haven't had the time I would like to spend on it I hope to make more substantial additions as time goes by.

1. Thank you message for Forms

Display thank you HTML document to user who has filled in a form using the mailto method. This script and form is relatively simple. The form uses the mailto: method to post results of a form submission to the author. The script simply acts to create a new window with a thank you message when the submit button is pressed. The disadvantage with this system is that few browsers other than Netscape support the mailto method for forms. The danger is that the user will think that their form has been successfully processed and close the mail dialogue box that appears, therefore the thank you message should also warn them of this.

Form Example 1

The pages and script:
Form Example 1
Form Acknowledgement Page

2. Another Thank you message for Forms

Display thank you HTML document to user who has filled in a form using the mailto method. The form also has Javascript ensure that valid data is entered (no blank fields). Javascript is also used to set/get cookies that indicate whether the user has filled in the form and submitted it. The form uses the mailto: method to post results of a form submission to the author. The script simply acts to create a new window with a thank you message when the submit button is pressed. The disadvantage with this system is that few browsers other than Netscape support the mailto method for forms. If the user fails to fill in the form, the scrpt asks them if they want to provide feedback, if they cancel out another page is displayed

Form Example 2

The Script:
Form Example 2

3. Shock your visitor by identifying what Operating System they use

With this script you have a good idea of the Operating System of the computer your visitors are using. This script uses the Javascript navigator.userAgent object to identify the operating system that the visitor uses. It then displays this in a document telling the user what operating system they appear to be using. If it cannot identify the operating system, it informs the user. A little modification could take the user to a form that they could fill in with the name of their operating system. The navigator.userAgent string could be inserted into the field and the form submitted either by the mailto protocol or via a CGI script. This would then allow you to cater for new operating systems. This script could fairly easily be ported to PERL or another language used for CGI to write to a log file. You could then see what operating system is most popular amongst your visitors. Add functionality to determine the browser used and you could determine whether it's worthwhile to cater to a particular group of users.

Determine Visitor's Operating System

4. Play a sound depending on the Visitor's Browser

In this script, I use javascript to detect the browser that the visitor is using, then use different HTML tags to play a sound depending on that browser. For example, if a visitor were using Internet Explorer I would use the <BGSOUND> tag, if they were using Netscape Navigator I would use the <EMBED> tag. I have yet to implement support for other browsers as I want to test the behaviour thoroughly.

Samples

The Pit
My father's page
My Cool Links page

The Script

Detect Browser and play sound

5. Hide your email address from spammers

In this script, I use javascript to hide my address from spammers. One of the tricks spammers employ is to use programs to find email addresses in web pages, they then take those email addresses and add them to their list of victims. Here's one way to combat it, use Javascript to build your email address on the page on the fly. The spambot can't find your email address as it's not in the source code for your page in the format that it's looking for.

Instructions:
Save the script below to your web page(s). You need to change two variables in the script. The two variables you need to change are 'name' and 'domain'. The name part is your username, the domain is the rest of the address following the @ symbol. As an example, for my address , I would set 'name' to enigman and 'domain' to ozemail.com.au. Then insert the script with your changes anywhere you would normally put your email address on your web page(s). The disadvantage of this script is that browsers that don't have Javascript enabled won't see your email but you will make it much harder for spammers to get hold of your email address.

The Script:
No Spam script


Enigman's Home Page |  Enigman's Cool Links | Favourite Latin Sayings | About Me | What's New | HTML Info Index | Site Map |

Page maintained by Grant Schmarr,
Copyright © 1997-99 Grant Schmarr.
Created: 22nd September 1997. Updated: 24th November 1999
Powered by O'Reilly Books