Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > help: select box 'launch' menu

Reply
Thread Tools

help: select box 'launch' menu

 
 
mark | r
Guest
Posts: n/a
 
      06-26-2003
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>



 
Reply With Quote
 
 
 
 
mark | r
Guest
Posts: n/a
 
      06-26-2003
> >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[i].selected == true) {
> top.location=document.getElementById("dest").optio ns[i].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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select box - using refresh to select same item twice entfred@hotmail.com Javascript 2 07-25-2006 11:54 PM
Dumb question about using a <SELECT> menu to change the state of<SELECT> menu... Bonge Boo! Javascript 5 04-25-2005 10:49 PM
Submit button to select all items in a SELECT menu Gumtree Javascript 3 11-10-2004 01:45 PM
<select tag> - how do I set the current index in a multiple select box? Ferd Berfel Javascript 4 04-06-2004 06:53 PM
select of select box will select multiple in another box palmiere Javascript 1 02-09-2004 01:11 PM



Advertisments