how to pop up a new window using javascript?

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
nullvalue
Beginner
Beginner
Posts: 2
Joined: Mon Jul 07, 2003 8:20 pm
Location: chicago
Contact:

how to pop up a new window using javascript?

Post by nullvalue »

I am editing the menu_array.js file, when someone clicks on a menu item, I want to pop open a new window using javascript (to resize the window, remove menu bars, etc). This causes a javascript error "Expected: ')'". Here's the code for the menu item:

Code: Select all

,"<img src=xpquestion.gif border=0>About","javascript:window.open('popup.htm','_blank','height=150,width=350,status=no,titlebar=no,toolbar=no,menubar=no,location=no'); onbordercolor=316AC5;offbordercolor=FFFFFF;",,"About",0

Thanks in Advance.

Aron Hoekstra
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

Do you really need to use JS to do this? On my page I just use the following:

Code: Select all

,"Wigan MBC","http://www.wiganmbc.gov.uk/ target=newframe",,"Wigan Metropolitan Borough Council",1
the target=newframe seems to do the job.
nullvalue
Beginner
Beginner
Posts: 2
Joined: Mon Jul 07, 2003 8:20 pm
Location: chicago
Contact:

Post by nullvalue »

fredlongworthhighschool wrote:Do you really need to use JS to do this?
Yes, I do have to use JavaScript for this, so that the window can be opened with the correct height & width, and remove status, menu and tool bars.
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

Here is the line of code that I use to do what you are asking and the actual function within my index file. Hope it helps.



"News","javascript:openNewWindow(\"news.htm\",310,350,\"scrollbars=yes\") onbackcolor=55bbff;offbackcolor=ff0000;",,"PopUp News",1
--------------------------------------------------------------------------------
<script language="JavaScript">
<!--

//-->
function openNewWindow(winURL,winWidth,winHeight,winConfig)
{
mmConfig=""
mmConfig="width="+winWidth+","
mmConfig+="height="+winHeight+","
mmConfig+=winConfig
var mmWin=open(winURL,"",mmConfig);
mmWin.focus();
}//-->
</script>
valkyrie258
Beginner
Beginner
Posts: 9
Joined: Wed Nov 19, 2003 8:47 pm
Location: Rochester, New York
Contact:

Post by valkyrie258 »

the lines in the code don't look like 3.x version. they look like the 5.x versions. Is it? and with that code, am i able to get the like no status or toolbar or menubar etc.?
:roll: :roll:
~Matt~
Http://wdtechzone.com - - - Best place for future web designers
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

No, the line of code within the menu_array.js file is Version 3 code.
The line of code calls the function and passes the name of the file to display in the pop up window, height and width and tells it to put scroll bars on the popup window.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Does the menu sample at http://milonic.com/menusample.php?sampleid=11 not help?

There are instructions for opening windows using windowFeatures on that page.

Cheers
Andy
Post Reply