help: select box 'launch' menu

Discussion in 'HTML' started by mark | r, Jun 26, 2003.

  1. mark | r

    mark | r Guest

    im having trouble with a select box launch menu...

    i need it to be activated by an onclick event by a button that isnt in the
    form.
    my scripts look like...

    <SCRIPT>
    function leapto()
    {top.location=document.form['formtwo'].dest.options[myindex].value; }
    </SCRIPT>

    <form name="formtwo" action=""><SELECT NAME="dest" SIZE=1>
    <option SELECTED VALUE="#">Regional Outlets</option>
    <option VALUE="http://www.newmediadesigns.co.uk">link one</option>
    <option VALUE="http://www.andel.co.uk">link two</option>
    </SELECT></form>

    <a href="javascript://" onClick="leapto()"><img src="images/b-go.gif"
    width="64" height="40" alt="submit this search" class="imgover"
    border="0"></a>
     
    mark | r, Jun 26, 2003
    #1
    1. Advertising

  2. mark | r

    mark | r Guest

    > >i need it to be activated by an onclick event by a button that isnt in
    the
    > >form.
    > > Why can't the button be in the form?
    > > >my scripts look like...

    ><SCRIPT>
    > >function leapto()
    > > {top.location=document.form['formtwo'].dest.options[myindex].value; }
    > ></SCRIPT>
    > ><form name="formtwo" action=""><SELECT NAME="dest" SIZE=1>
    > ><option SELECTED VALUE="#">Regional Outlets</option>
    > ><option VALUE="http://www.newmediadesigns.co.uk">link one</option>
    > ><option VALUE="http://www.andel.co.uk">link two</option>
    > ></SELECT></form>
    > >
    > ><a href="javascript://" onClick="leapto()"><img src="images/b-go.gif"
    > >width="64" height="40" alt="submit this search" class="imgover"
    > >border="0"></a>

    >
    > So many things wrong with this in principle, before we even get to
    > your coding problem. It fails totally if JavaScript is not enabled.
    > The alt attribute is misleading (this is not a search). It looks like
    > a form but it's really just a user unfriendly way of rendering a list
    > of ordinary links.
    >
    > Still, I doubt that you're interested in any of that. You just want a
    > quick fix to your superficial problems.
    >
    > <script type="text/javascript">
    > function leapto() {
    > for (i=0; i < document.getElementById("dest").options.length; i++) {
    > if (document.getElementById("dest").options.selected == true) {
    > top.location=document.getElementById("dest").options.value;
    > }
    > }
    > return false;
    > }
    > </script>
    >
    > <form action="navpage.html" method="get" onSubmit="return leapto()">
    > <SELECT id="dest" NAME="dest">
    > <option SELECTED VALUE="#">Regional Outlets</option>
    > <option VALUE="http://www.newmediadesigns.co.uk">link one</option>
    > <option VALUE="http://www.andel.co.uk">link two</option>
    > </SELECT>
    > </form>
    >
    > <a href="navpage.html" onClick="return leapto();"><img
    > src="images/b-go.gif" width="64" height="40" alt="something
    > useful"></a>
    >
    > The navpage.html should contain the same links as your dropdown but as
    > a standard list of links, so that users without JavaScript can still
    > get to the pages in question.



    thanks ste'

    thanks for the rescue! i appreciate your comments and think the work-around
    is excellent.

    mark
     
    mark | r, Jun 26, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gnarlodious
    Replies:
    4
    Views:
    17,712
    elizas
    May 5, 2010
  2. Robin
    Replies:
    2
    Views:
    197
    Robin
    Apr 9, 2004
  3. Sy Ys
    Replies:
    0
    Views:
    141
    Sy Ys
    Sep 15, 2007
  4. palmiere
    Replies:
    1
    Views:
    467
    Erwin Moller
    Feb 9, 2004
  5. Bonge Boo!
    Replies:
    5
    Views:
    230
    Bonge Boo!
    Apr 25, 2005
Loading...

Share This Page