Home   News  Product reviews  Website reviews  Forums   Competitions  Subscribe 


Web Building >> Web design & build
 |  Print Topic
Jump to first unread post. Pages: 1
tomoslewis
regular


Reg'd: Wed
Posts: 94
form link help
      #69608 - Wed May 19 2004 08:39 PM

i'm using a drop down table for some links, but i need the links to open ni a different window- the _top target. i've tried but failed miseralby.anyone?


Post Extras: Print Post   Remind Me!   Notify Moderator  
tomoslewis
regular


Reg'd: Wed
Posts: 94
Re: form link help [Re: tomoslewis]
      #69841 - Thu May 20 2004 04:15 PM

this is the form code

<form>
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1" class="form">
<option value="#" selected>Choose player:</option>
<option value="alangoodall.htm target=_top">Alan Goodall</option>
<option value="aledrowlands.htm">Aled Rowlands</option>
<option value="claytonblackmore.htm">Clayton Blackmore</option>
<option value="eifionjones.htm">Eifion Jones</option>
<option value="frankmottram.htm">Frank Mottram</option>
<option value="garethevans.htm">Gareth Evans</option>
<option value="garethwilliams.htm">Gareth Williams</option>
<option value="huwgriffiths">Huw Griffiths</option>
<option value="kennyburgess.htm">Kenny Burgess</option>
<option value="lesdavies.htm">Les Davies</option>
<option value="markconnolly.htm">Mark Connolly</option>
<option value="owaintudurjones.htm">Owain Tudur Jones</option>
<option value="paulfriel.htm">Paul Friel</option>
<option value="paulgedman.htm">Paul Gedman</option>
<option value="paulroberts.htm">Paul Roberts</option>
<option value="peterhoy.htm">Peter Hoy</option>
<option value="rossjefferies.htm">Ross Jefferies</option>
</select></form>


Post Extras: Print Post   Remind Me!   Notify Moderator  
gollum
regular


Reg'd: Wed
Posts: 278
Re: form link help [Re: tomoslewis]
      #69848 - Thu May 20 2004 04:40 PM

I did something like this a couple of years ago, but kept it in the same window. For my example, I set up a function called 'nav' as I had several menus of this type and wanted a fuction to deal with all of them...
You will need to do the same. I munged my code so it opens in a new window..

function nav ( locn) {window.open( locn )}

You can call it what you like. What you do is send the url to nav using the onchange and the fuction opens it in a new window.

Here is my code for the menu to show how it works

<form name="webmaster" class="normalform">
<select name="freebies" class="textform" onChange="nav (document.webmaster.freebies.options[selectedIndex].value)">
<option value="*"> ~~ The Basics ~~
<option value="email.shtml"> Email
<option value="graphics.shtml"> Graphics
<option value="midi.shtml"> Midis
<option value="redirect.shtml"> Redirect URL's
<option value="tutorial.shtml"> Tutorials
<option value="webspace.shtml"> Web Space
</select>


It is easy to implement in your code.

NB this sort of code isnt search engine friendly, so if you want to have search engines index it, use noscript tags and put html links in for all the pages used in above method. New browsers ignore anything between noscript tags so it doesnt look unsightly.

HTH



Post Extras: Print Post   Remind Me!   Notify Moderator  
tomoslewis
regular


Reg'd: Wed
Posts: 94
Re: form link help [Re: gollum]
      #69854 - Thu May 20 2004 04:51 PM

does this change the target the links open to?i don't want to change the form too much, only the target of all the links.


Post Extras: Print Post   Remind Me!   Notify Moderator  
gollum
regular


Reg'd: Wed
Posts: 278
Re: form link help [Re: tomoslewis]
      #69868 - Thu May 20 2004 05:33 PM

This doesnt alter the target of all your links... just opens any links from the menu in a new browser window. The fuction nav is a simple one; it justs opens the url you send it int a new window. its only called by the 'onchange' attribute.

Try it and let me know what you think.



Post Extras: Print Post   Remind Me!   Notify Moderator  
tomoslewis
regular


Reg'd: Wed
Posts: 94
Re: form link help [Re: gollum]
      #69921 - Thu May 20 2004 07:24 PM

works, but i don't want it to open a new window, just a different target.thanks anyway


Post Extras: Print Post   Remind Me!   Notify Moderator  
gollum
regular


Reg'd: Wed
Posts: 278
Re: form link help [Re: tomoslewis]
      #69984 - Thu May 20 2004 08:38 PM

Ok.. i misunderstood..
change this
<select onchange="window.location.href=this.options[this.selectedIndex].value" size="1" class="form">
in you original code to:

<select onchange="top.location.href=this.options[this.selectedIndex].value" size="1" class="form">


It should work how you want it to this time



Post Extras: Print Post   Remind Me!   Notify Moderator  
tomoslewis
regular


Reg'd: Wed
Posts: 94
Re: form link help [Re: gollum]
      #69994 - Thu May 20 2004 08:57 PM

perfect.cheers


Post Extras: Print Post   Remind Me!   Notify Moderator  
gollum
regular


Reg'd: Wed
Posts: 278
Re: form link help [Re: tomoslewis]
      #70025 - Thu May 20 2004 09:45 PM

Glad to help


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1

Rate this topic

Jump to


Extra information
0 registered and 13 anonymous users are browsing this forum.

Moderator:  putasolutions, Joe_London, greysts, bricat, Nanook, Hello_There, John_McKenna, Mouse, TheFatControlleR 


Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      Mark-up is enabled

Rating:
Topic views: 291

Contact Us | Privacy statement Main website