menu using html and vbscript

  • 19 years ago

    need to design drop down menu using html and vbscript

  • 19 years ago

    Hi. It's a really really bad idea to use client-side VBScript, as it is only supported by Internet Explorer. I myself am a Netscape hater, but if people insist on using second-rate software when you can get stuff far better for free, well, we should at least try to make their www experience work! This is why I would recommend using JavaScript instead, as it'll work on both browsers. Here is an example:


    Stick this script inside the <head>...</head> tags:


    <script language ="JavaScript">
    <!-- begin hiding --
    function menuLinks() {
    url = document.menuform.menu.options[document.menuform.menu.selectedIndex].value;
    window.location.href = url;
    }
    //-->
    </script>


    And then this form in the <body>...</body> tags:


    <form name="menuform">
    <select name="menu" onChange ="menuLinks()">
    <option value ="bottomframe.html">Home</option>
    <option value ="sign.html">Sign Guestbook</option>
    <option value ="meet/meet.html">Meet the Band</option>
    <option value ="photo/photos.html">Photos</option>
    <option value ="singles.html">Singles</option>
    <option value ="albums.html">Albums</option>
    <option value ="tourdates.html">Tour Dates</option>
    <option value ="actualites.html">Media Articles</option>
    <option value ="links.html">Links</option>
    <option value ="dlist.html">Join</option>
    </select>
    <input type ="button" value ="View" onClick ="menuLinks()"></form>


    This gives you the option of allowing the page to be viewed either as soon as the menu item is selected or when you click the button. To make the script wait until the button's been clicked, simply rewrite the <select> tag as follows: <select name="menu">


    If you want the page to be viewed in another frame, then change the script up the top to this:


    parent.FrameName.location.href = url;


    where FrameName is the name of your frame.


    I hope this is useful, if it was please email [email protected]

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An expert is a man who has made all the mistakes that can be made in a very narrow field” - Niels Bohr