Atryeu Designs » Web Design » Freebies » Javascript » Fun Scripts
Feel free to use the scripts listed below for your site if you wish. Before you can use them, you must agree to the Terms of Use. Please do not give out these codes, send people here to get them instead. Please do not remove my comments from the codes either.


To use the scripts, copy and paste the codes to your website. Pay attention to special instructions listed along with the codes below. The codes listed below will have a colored background so you know where the code snippets are.


Simple Alert Code

This code will bring up an alert when your page loads....

Code Example (note the below code will load when you open the page, not when you click a link): Click to see Alert Example

Copy and paste the below code to your website. Add your own message where it says "Your Message Goes Here" but keep the quotes as they are.

<!-- Simple Alert Code written by Atryeu Designs http://www.atryeu.net -->
<script language="javascript">
alert('Your Message Goes Here'); //--> </script>



Simple Alert Code 2

Like the first alert code, this will bring up an alert box on your page, however this one brings up the alert when you click a link instead like in the example above.

Code Example: Click to see Alert Example

Copy and paste the below code to your website. Add your own message where it says "Your Message Goes Here" but keep the quotes as they are.

<!-- Simple Alert Code written by Atryeu Designs http://www.atryeu.net -->
<a href="#" onClick="alert('Your Message Goes Here');">Your Link Goes Here</a>



Simple Referrer Code

This script will show the viewer the last page they visited before coming to your page with the script on it.

Code Example:

Copy and paste the below code to your website. Add your own message where it says "Your Message Goes Here" but keep the quotes as they are.

<!-- Simple Referrer Code written by Atryeu Designs http://www.atryeu.net -->
<script language="javascript">
if (document.referrer != "") {
document.write("You just came from: " + document.referrer + ".") }
</script>



Simple Prompt Code

This script will bring up a prompt window for a user to enter an answer to a question and based on the answer will write a specific reply on your page based on their answer.

Code Example: No example at this time, sorry.

Copy and paste the below code to your website. Add your own question and answers where it says "Question" and "Answer" (keep the quotes in the code as they are). Question has to be multiple choice and the user needs to spell the choice correctly for the script to work. When you enter your Answer, make sure there is a space after what you write! The "Default Answer" is what the user will get if nothing or something other than one of the choices (or a choice is mispelled).

You also need to enter your multiple choice answers were it says "Choice". Keep them simple by using just 1 word and do not include spaces or special symbols or characters. You can add more choices if you like by copying and pasting from 'case' to the end of 'break;' but remember it's best to keep things simple.

<!-- Simple Prompt Code written by Atryeu Designs http://www.atryeu.net -->
<script language="javascript">
var question;
question = window.prompt("Your Question Goes Here along with possible Multiple Choice Repsonses for the User to Enter");
switch (question)
{
case "Choice":
document.write("Answer ", question);
break;
case "Choice":
document.write("Answer ", question);
break;
case "Choice":
document.write("Answer ", question);
break;
default:
document.write("Default Answer ", question);
</script>