CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    2

    How Do I Add A Url To A Menu???

    Hi

    I need to be able to add a url and web site name to a drop down menu. Unfortunately this has to be an ActiveX menu. I can get the name of the web site to add and delete but I can't seem to find a way to get the url to add to the list. Could anyone shed some light on this for me?

    Heres my code:


    <html>

    <head>
    <title>My Favourite Web Sites</title>
    <script LANGUAGE="JavaScript">
    Sites = new Array()
    Sites[0]= "http://www.yahoo.com";
    Sites[1]= "http://www.godskitchen.com";
    Sites[2]= "http://www.powertrance.com";
    Sites[3]= "http://www.lycos.com";
    Sites[4]= "http://www.s4c.com";
    Sites[5]= "http://www.sundissential.com";
    Sites[6]= "http://www.hotmail.com";
    Sites[7]= "http://www.tidy.com";
    Sites[8]= "http://www.askjeeves.com";
    Sites[9]= "http://www.google.com";
    (myform.websiteaddress.value);
    window.location.href=Sites[item];
    </script>

    <script LANGUAGE="JavaScript" FOR="mnu" EVENT="select(item)">
    GetNumber=(item-1);
    address=(Sites[GetNumber]);
    window.location.href=(address);
    </script>
    </head>

    <body>

    <object ID="mnu" WIDTH="150" HEIGHT="20"
    CLASSID="clsid:52DFAE60-CEBF-11CF-A3A9-00A0C9034920"
    CODEBASE="http://activex.microsoft.com/controls/iexplorer/x86/btnmenu.cab#Version=4,71,115,0"
    <param name="ExtentX" value="1402">
    <param name="ExtentY" value="529">
    <param name="Caption" value="My Favourite Web Sites">
    <param name="Menuitem[0]" value="Yahoo">
    <param name="Menuitem[1]" value="Godskitchen">
    <param name="Menuitem[2]" value="Powertrance">
    <param name="Menuitem[3]" value="Lycos">
    <param name="Menuitem[4]" value="S4C">
    <param name="Menuitem[5]" value="Sundissential">
    <param name="Menuitem[6]" value="Hotmail">
    <param name="Menuitem[7]" value="Tidy">
    <param name="Menuitem[8]" value="Askjeeves">
    <param name="Menuitem[9]" value="Google">
    </object>

    <form ACTION="--WEBBOT-SELF--" METHOD="POST" NAME="myform">

    Name<input TYPE="text" SIZE="20" NAME="websitename">

    URL<input TYPE="text" SIZE="20" NAME="websiteaddress">

    Position<input TYPE="text" SIZE="20" NAME="pos">

    <input LANGUAGE="JavaScript" TYPE="button" VALUE="Delete" ONCLICK="mnu.removeItem(myform.pos.value)" NAME="DeleteButton">
    </SCRIPT>

    <input LANGUAGE="JavaScript" TYPE="button" VALUE="add" ONCLICK="mnu.addItem(myform.websitename.value,eval(myform.pos.value))" NAME="addbut">

    </script>
    </form>

    </body>
    </html>


    Instructions:

    To remove a web site name input the position of the one you want to delete in the position text box (from 1-10) and click delete. Then type in your choice of web site name and address and click add. The name adds but the old web site that was their before stays.

    Any ideas anyone? Also how do I limit the list to no more than 10?

    Any help is extremely appreciated xxx

    Thanks xxx

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163
    You might get a better response in a JavaScript forum...

    The price of justice is eternal publicity...
    Please use &#91;CODE]...your code here...&#91;/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured