Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to use VBScript or JavaScript to create a drop-down control that opens a specific URL in FrontPage 2000

View products that this article applies to.


This article provides four examples of how to use Microsoft Visual Basic Scripting Edition (VBScript) or JavaScript to create a drop-down control that opens a specific Uniform Resource Locator (URL) based on the choice you make from a list.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
To paste the code below into your page, switch to the HTML view in FrontPage and place your insertion point where you want the drop-down control inserted. The drop-down control needs to be inserted after the open body tag:
and before the close body tag:

Example 1

<p>A drop down scripted URL list</p>

   <form method="POST" name="SendMe">
    <p><select name="DropIt" size="1">
        <option> </option>
        <option> </option>
        <option> </option>
        <option> </option>
    </select> <input type="button" name="B1" value="Go">
     <SCRIPT FOR="B1" EVENT="onClick" LANGUAGE="VBScript">
     select case document.sendme.dropit.selectedindex
          case 0
          case 1
          case 2
          case 3
     end select

Example 2

<form method="POST" name="SendMe2">
   <select name="Cleaner" size="1">
      <option value=""> </option>
      <option value=""> </option>
      <option value=""> </option>
      <option value=""> </option>
   </select> <input type="button" name="B2" value="Go">

   <SCRIPT FOR="B2" EVENT="onClick" LANGUAGE="VBScript">
   dim choice
   choice = document.SendMe2.Cleaner.selectedindex
   navigate document.SendMe2.Cleaner.options(choice).value

Example 3

<form name="menuform">
    <div align="center"><center><table border="0">
            <td align="center"><font size="4">Where Do You Want
             to Go Today?</font></td>
            <td><select name="section" size="1" width="200"
            language="javascript" onchange="goto_page();">
                <option selected>Where do you want to go
                <option> - - - - - - - - - - - - - - - - - </option>
                <option>FrontPage Home Page</option>
                <option>FrontPage Support Page</option>
                <option>Microsoft Office Home Page</option>
                <option>Microsoft Windows 95 Home Page</option>
                <option>Microsoft Windows NT Home Page</option>
                <option>Microsoft IIS Home Page</option>

   <p><script language="JavaScript"><!--
   function goto_page() {
        if (document.menuform.elements[0].selectedIndex == 0)
   window.parent.self.status=" Goes Nowhere";
        else if (document.menuform.elements[0].selectedIndex == 1)
   window.parent.self.status=" Goes Nowhere";
        else if (document.menuform.elements[0].selectedIndex == 2)"", target="_top")
        else if (document.menuform.elements[0].selectedIndex == 3)"", target="_top");
        else if (document.menuform.elements[0].selectedIndex == 4)"",
        else if (document.menuform.elements[0].selectedIndex == 5)"", target="_top");
        else if (document.menuform.elements[0].selectedIndex == 6)"", target="_top");
        else if (document.menuform.elements[0].selectedIndex == 7)"", target="_top");
        else if (document.menuform.elements[0].selectedIndex == 8)"", target="_top");
   // --></script>

Example 4

<SCRIPT language="JavaScript">
   function setaction(jumpto)
        if (jumpto == 0) window.location = "example1.htm";
   else if (jumpto == 1) window.location = "example2.htm";
   else if (jumpto == 2) window.location = "example3.htm";
   else if (jumpto == 3) window.location = "example4.htm";
   else if (jumpto == 4) window.location = "example5.htm";
   else if (jumpto == 5) window.location = "example6.htm";
   else if (jumpto == 6) window.location = "example7.htm";
   else if (jumpto == 7) window.location = "example8.htm";
   else if (jumpto == 8) window.location = "example9.htm";
   else if (jumpto == 9) window.location = "";
   else window.location = "";
   // --></Script>
   <form method="POST">
    <div align="center"><center>
    <pre><select name="dest" size="1">
    <option>Example One</option>
    <option>Example Two</option>
    <option>Example Three</option>
    <option>Example Four</option>
    <option>Example Five</option>
    <option>Example Six</option>
    <option>Example Seven</option>
    <option>Example Eight</option>
    <option>Example Nine</option>
    <option>ExampleHome Page (Do Not Use)</option>
    <option>Really, Do Not Use This!</option>
    <INPUT TYPE=BUTTON VALUE="Submit Example"

↑ Back to the top

Keywords: KB197959, kbhowtomaster, kbprogramming, kbscript

↑ Back to the top

Article Info
Article ID : 197959
Revision : 3
Created on : 5/28/2007
Published on : 5/28/2007
Exists online : False
Views : 332