Jump to content

Drop-Down with links opening in new window?


Agent Moose

Recommended Posts

I am trying to figure out how to open something in a new window when the value is in a drop-down menu...Here is my code...

<div align="center"><b>Listen To</b><form name="myMenu"><select name="menu"><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=vradio>Variety Hits</option><option value="">deathwilldie</option><input type="button" onClick="top.location=document.myMenu.menu.options[document.myMenu.menu.selectedIndex].value;" value="Submit"></form>
This is the link I want to have open in a new window...http://www.1club.fm/clubfm_media/v42.aspx?station=vradioAlso I want it to open so the size of the window is:width=747height=462Anybody wanna help?
Link to comment
Share on other sites

You could just use the:

target="_blank"

But as for changing the size, you will need to use JAVA I think, I will post an email that someone sent me about this...To be able to specify pretty much everything about the new window you need to try quite a bit harder, and use javascript.You need to put some code in the page header, exactly like this (don't take out any spaces or line breaks):

<script LANGUAGE="JAVASCRIPT">function MM_openBrWindow(theURL,winName,features) { //v2.0   window.open(theURL,winName,features);}// --></SCRIPT>

And then, in the body of the page where you want the words "click here" to take you to a page called "filename.htm", you put:

<ahref="java script:MM_openBrWindow('filename.htm','filename','width=650,height=550,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no')">click here </a>

Note that "filename" has to appear twice in the code - once to tell it where to go and again (without the ".htm") to give the whole procedure a name (it's a javascript thing!).Also note that this link specifies the width and height of the new window, that it should have a menu bar but no status bar or toolbar, and so forth. You can fiddle with all of those settings to your heart's content :-)

Link to comment
Share on other sites

Right, I am not sure wether you put it in the right place, so here is an example...

<a target="_blank" href="imagegallery/038.html">

Also, the two codes that I sent you were for normal links so, I am not sure wether they will owrk in a drop down menu. :)

Link to comment
Share on other sites

You might try a function like this:

<script type="text/javascript">function pop_window(url){	var properties = "height=462,width=747";	var window_name = "myNewWindow";	window.open(url,window_name,properties);}</script>

And then call it like this:

<input type="button" onclick="pop_window(document.myMenu.menu.options[document.myMenu.menu.selectedIndex].value);" value="Submit">

Link to comment
Share on other sites

That doesn't work. This is how I have to code:

<script type="text/javascript">function pop_window(url){	var properties = "height=462,width=747";	var window_name = "myNewWindow";	window.open(url,window_name,properties);}</script><div align="center"><b>Listen To</b><form name="myMenu"><select name="menu" onchange="go(this, 1, false)"><option value="http://www.1club.fm/clubfm_media/v42.aspx?station=vradio">Variety Hits</option><option value="">deathwilldie</option><input type="button" onclick="pop_window(document.myMenu.menu.options[document.myMenu.menu.selectedIndex].value);" value="Submit">

Link to comment
Share on other sites

Get rid of the onchange="go(this, 1, false)" in the select element. When the person clicks the submit button, the new window will open. Your code, with that modification, works for me in Firefox.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...