Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NewWindow from menu_array

Status
Not open for further replies.

ppuddick

ISP
Nov 15, 2002
56
GB
Hi all,

First of all I'm new to this Javascript game. Secondly, thanks in advance for reading this.

Essentially what I want to do is to open up a new window from my menu_array.js - not only a new window but a pre-determined sized window in the middle of the users screen. I have achieved this before with html code calling upon the script below


//Pop up style windows will always open in the middle of the users screen
function NewWindow(mypage,myname,w,h,scroll)
{
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',lef
t='+LeftPosition+',scrollbars='+scroll+',resizable
'
win = window.open(mypage,myname,settings)
}


Then by calling upon it from the html like so


href="mypage.htm" onclick="NewWindow(this.href, 'name' , '500' , '420', 'no'); return false"


But I cannot for the life of me fathom out how to do this from a menu_array.js file

My menu_array is working fine to a degree but all pages accessed via the menu all appear in the same window. I've hunted around and looked at other sites using a menu_array and noticed that they're the same. Maybe I'm not looking hard enough.

I could go back and use an html form but I think the javascript array looks much, much better,

I hope I've made myself clear. Thank you once again for reading. Any help would be much appreciated

From a Javascript Noob

 
in your menu_array.js file, whereever you put the filename for the menu to trigger, try replacing the filename with

javascript:NewWindow('myPageName.html', 'name' , '500' , '420', 'no'); return false;

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Hi Jemminger,

Thank you for your prompt reply. I've tried that but no such luck.

I think you're on the right track though :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top