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 FormsDisplay 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 1The pages and script:Form Example 1Form Acknowledgement Page 2. Another Thank you message for FormsDisplay 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 2The Script:Form Example 23. Shock your visitor by identifying what Operating System they useWith 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 BrowserIn 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 The Script 5. Hide your email address from spammersIn 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: The Script:No Spam script |
Page maintained by Grant Schmarr,
|