FutureQuest, Inc. FutureQuest, Inc. FutureQuest, Inc.
A Lil Bit O' JavaScript
Posted on 04 December 2003 11:55 PM

Forward & Back Buttons

These work just like the directional buttons on a browser. Copy & Paste the following code to your web page. Change the VALUE="BACK" or VALUE="FORWARD" to whatever you would like the buttons to say.

    <INPUT TYPE="button"
    VALUE="BACK"
    onClick="history.go(-1)">
    <INPUT TYPE="button"
    VALUE="FORWARD"
    onCLick="history.go(1)">


Email Button W/ Subject

 

Press the button to email a designated address complete with defined subject.

 

Copy & Paste the following code to your web page. Replace YourEmail@YourDomain.tld with the email address you wish to use. Replace Your_Subject with the subject you would like the message to contain.
    <INPUT TYPE="button"
    VALUE="EMail"
    onClick="parent.location='mailto:YourEmail@YourDomain.tld?subject=Your_Subject'">

Message In Status Bar When Mouse Is Over Link

 

Place your Mouse over this link

Copy & Paste the following code to your web page. Replace http://www.FutureQuest.net/ with the url you would like the link to take you to when clicked. Replace Your_Message with the message you would like to see in the status bar. Replace Link_Title with the title of the link that shows on the page.

    <A HREF="http://www.FutureQuest.net/" onMouseOver="self.status='Your_Message'; return true">Link_Title</A>

     


Pull-Down Menu

Copy & Paste the following code to your web page. Replace Page1.html, Page2.html, etc with the correct urls you would like the links to take you to when selected. Replace Page 1, Page 2, etc with the correct link titles to be shown in the menu. Replace "GO!" with whatever you would like the button to say. You may add as many links to this menu as you would like. Just continue with more OPTION VALUE= lines.

    <script language="javascript">
    <!-- Hide the script from old browsers --
    function surfto(form) {
    var myindex=form.dest.selectedIndex
    location=form.dest.options[myindex].value;
    }
    //-->
    </SCRIPT>
    <FORM NAME="myform">
    <SELECT NAME="dest" SIZE=1 onChange="surfto(this.form)">
    <OPTION SELECTED VALUE="Page1.html">PAGE 1
    <OPTION VALUE="Page2.html">PAGE 2
    <OPTION VALUE="Page3.html">PAGE 3
    </SELECT>
    <INPUT TYPE="BUTTON" VALUE="Go!" onClick="surfto(this.form)">
    </FORM></CENTER>

On Click Script Alert

 

(Not a working example.)
    Step 1: Copy & Paste the following code into the <HEAD></HEAD> tags of your page. Replace The Alert Message with your message.
    <SCRIPT LANGUAGE="javascript">
    <!-- Begin
    function drawAlert () {
    alert ("The Alert Message");
    }
    // End -->
    </SCRIPT>

    Step 2: Copy & Paste the following code into your web page where you want it to be seen. Replace "Click Me!" with whatever you would like the button to say.

    <FORM>
    <input type=button value="Click Me!" onClick="drawAlert()">
    </FORM>

When the button is clicked, it will result in the alert message being displayed in a pop up javascript box.
Pop-Up Script Alert

This creates a javascript box that pops-up before the page loads. The visitor will either enter or return from whence s/he came depending on his/her answer. (NOTE - There is no visual aid included on this one as it could be annoying to have the alert keep popping up.) Copy & Paste the following code into the <HEAD></HEAD>tags of your page. Replace Alert Message with your message.

    <SCRIPT LANGUAGE="javascript">
    <!-- Begin
    var agree=confirm("Alert Message");
    if (agree)
    document.write("");
    else
    history.go(-1);
    // End -->
    </SCRIPT>

URL Forwarding

This automatically sends visitors to a new URL as soon as they enter your page. Copy & Paste the following code into the <HEAD></HEAD>tags of your page. Replace http://www.FutureQuest.net/ with the URL you would like visitors sent to.

    <script>window.location.href="http://www.FutureQuest.net/"</script>