Agent Moose Posted November 24, 2006 Share Posted November 24, 2006 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 More sharing options...
holmedwa04 Posted November 25, 2006 Share Posted November 25, 2006 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 More sharing options...
Agent Moose Posted November 25, 2006 Author Share Posted November 25, 2006 Thanks, it confuses me a little bit but I will try. Right now, I am thinkin is this a bit much to put just to make is so that when you click submit for a drop-down menu it opens up a new page. And I have tried target"_blank" it didn't work... Link to comment Share on other sites More sharing options...
holmedwa04 Posted November 25, 2006 Share Posted November 25, 2006 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 More sharing options...
Agent Moose Posted November 25, 2006 Author Share Posted November 25, 2006 Thanks, Right now I am looking for how do change the width and the height. This is how I had it: <a href="www.whatever.com" target="_blank" width="390" height="360">blah</a> Is that right? Link to comment Share on other sites More sharing options...
holmedwa04 Posted November 25, 2006 Share Posted November 25, 2006 It would appear to be right, but I do not know wether that is valid code. Does it work correctly? Link to comment Share on other sites More sharing options...
Agent Moose Posted November 25, 2006 Author Share Posted November 25, 2006 It only works when I have just this: <option value="www.blahlajf.com">blah</option> Link to comment Share on other sites More sharing options...
holmedwa04 Posted November 26, 2006 Share Posted November 26, 2006 I am completely confused now sorry. Link to comment Share on other sites More sharing options...
Agent Moose Posted November 26, 2006 Author Share Posted November 26, 2006 That is the only thing that I can use for a drop-down menu that works. Link to comment Share on other sites More sharing options...
holmedwa04 Posted November 26, 2006 Share Posted November 26, 2006 You may like to have a look at dynamic drive, they have drop down menus that I think you may be able to set href attributes in, here is the link:http://www.dynamicdrive.com/ Link to comment Share on other sites More sharing options...
jesh Posted November 27, 2006 Share Posted November 27, 2006 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 More sharing options...
Agent Moose Posted December 1, 2006 Author Share Posted December 1, 2006 What if I want to put more than just one option for it? Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 1, 2006 Share Posted December 1, 2006 What if I want to put more than just one option for it?His code would still work, as long as you follow this format:<option value="http://url here">Name here</option> Link to comment Share on other sites More sharing options...
Agent Moose Posted December 2, 2006 Author Share Posted December 2, 2006 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 More sharing options...
jesh Posted December 4, 2006 Share Posted December 4, 2006 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 More sharing options...
Agent Moose Posted December 6, 2006 Author Share Posted December 6, 2006 Sorry taht didn't work. Oh well, I just made a code that will have the same comonents that this one was going to have...it is in the Javascript section of this forum. Please lock or delete this topic, no need for it anymore. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now