iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old June 26th, 2009, 04:10 PM   #1
Reputable Member
 

Join Date: Mar 2006
Location: UK
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 snappy is on a distinguished road
jump menu to open window of specified size

I have a dropdown jump menu which I want to take the user to a new window of a specified size.

I'm using the following code in my head
Code:
<script type="text/javascript">
<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
and the following in my body
HTML Code:
 <form>
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('window.open()',this,0)">
      <option value="../thisplace.html">visit this place</option>
<option value="../thatplace.html">visit that place</option>
<option value="../otherplace.html">visit other place</option>
</select>
</form>
Can anyone tell me where I should put the parameters for the size and features of the newly opened window?

cheers everybody
snappy
snappy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old June 26th, 2009, 05:36 PM   #2
Reputable Member
 

Join Date: Nov 2008
Location: Lexington, KY
Posts: 243
Thanks: 0
Thanked 1 Time in 1 Post
Rep Altering Power: 0 Dubbs is on a distinguished road
Re: jump menu to open window of specified size

Why reinvite the wheel? Why not use window.open function that is already built into JavaScript?

Code:
 <form>
<select name="jumpMenu" id="jumpMenu" onchange="window.open('this.value','width=400,height=200')">
      <option value="../thisplace.html">visit this place</option>
<option value="../thatplace.html">visit that place</option>
<option value="../otherplace.html">visit other place</option>
</select>
</form>
That should open a new windows with the size being 400 pixels wide and 200 pixels tall.
Dubbs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old June 29th, 2009, 07:46 AM   #3
Reputable Member
 

Join Date: Mar 2006
Location: UK
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 snappy is on a distinguished road
Re: jump menu to open window of specified size

Sorry, can you expand?
Browser now looks for "this.value" rather than the new web page.
I'm guessing I need some more code somewhere!

thanks
snappy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old June 29th, 2009, 08:13 AM   #4
Reputable Member
 

Join Date: Mar 2006
Location: UK
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 snappy is on a distinguished road
Re: jump menu to open window of specified size

and another question on this: *sorry*
This 'pop-up' window is linked from twenty items on a menu.
There is a problem when selecting a second menu item in the same smaller window as it disappears behind the main window once you click back there again and when the user selects a new second menu item it is hidden behind the main window.
Once the new small window opens is there a way to close it automatically when the user clicks back on the main page or to open another new window when user selects a different menu item?
snappy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old June 30th, 2009, 11:31 AM   #5
Reputable Member
 

Join Date: Nov 2008
Location: Lexington, KY
Posts: 243
Thanks: 0
Thanked 1 Time in 1 Post
Rep Altering Power: 0 Dubbs is on a distinguished road
Re: jump menu to open window of specified size

Sorry the code should be

Code:
<form>
<select name="jumpMenu" id="jumpMenu" onchange="window.open(this.value,'width=400,height=200', 'child')">
      <option value="../thisplace.html">visit this place</option>
<option value="../thatplace.html">visit that place</option>
<option value="../otherplace.html">visit other place</option>
</select>
</form>
I have tested it with FF on Ubuntu and it works.


As for your second question, I was not able to do it with window.close(). What you maybe able to do is just name the window, that way when someone chooses the next option it updates the window with the new page. The code above does just that.
Dubbs is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old July 2nd, 2009, 03:01 PM   #6
Reputable Member
 

Join Date: Mar 2006
Location: UK
Posts: 116
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 snappy is on a distinguished road
Re: jump menu to open window of specified size

Quote:
Originally Posted by Dubbs View Post
Code:
<form>
<select name="jumpMenu" id="jumpMenu" onchange="window.open(this.value,'width=400,height=200', 'child')">
      <option value="../thisplace.html">visit this place</option>
<option value="../thatplace.html">visit that place</option>
<option value="../otherplace.html">visit other place</option>
</select>
</form>
I have tested it with FF on Ubuntu and it works.


As for your second question, I was not able to do it with window.close(). What you maybe able to do is just name the window, that way when someone chooses the next option it updates the window with the new page. The code above does just that.
That code above simply changes the content of the original 'popup' window so still stays behind the main page which is one of the problems I'm trying to solve.... or am I missing something here?
thanks

Last edited by snappy; July 2nd, 2009 at 03:05 PM.. Reason: submitted reply before completing
snappy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Open another new window from javascript window thehermitage JavaScript 10 January 27th, 2008 04:42 PM
[SOLVED] pagementation to jump menu saltedm8 PHP 19 January 26th, 2008 06:22 PM
Change open in new window to open in same window nsr500rossi JavaScript 2 January 18th, 2008 11:13 AM
[SOLVED] open new window from main window AdRock Other Languages 1 November 1st, 2007 12:45 AM
Double Jump Menu. Options Dont Appear ? Code help please Andy K JavaScript 1 June 20th, 2005 05:44 PM


Search Engine Optimization by vBSEO 3.2.0 RC8