Back To Start Of Archive
Taken From The Forum: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:26
how to pop up a new window using javascript?
Poster: nullvalue
Dated: Monday July 7 2003 - 20:27:27 BST
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:
,"<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
Poster: fredlongworthhighschool
Dated: Wednesday July 9 2003 - 8:51:33 BST
Do you really need to use JS to do this? On my page I just use the following:
Code:
,"Wigan MBC","http://www.wiganmbc.gov.uk/ target=newframe",,"Wigan Metropolitan Borough Council",1
the target=newframe seems to do the job.
Poster: nullvalue
Dated: Wednesday July 9 2003 - 14:46:47 BST
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.
Poster: bobwill
Dated: Friday July 11 2003 - 13:44:06 BST
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>
Poster: valkyrie258
Dated: Friday November 21 2003 - 19:50:26 GMT
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.?
Poster: bobwill
Dated: Saturday November 22 2003 - 14:17:40 GMT
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.
Poster: Andy
Dated: Sunday November 23 2003 - 11:31:07 GMT
Does the menu sample at http://www.milonic.com/menusample.php?sampleid=11 not help?
There are instructions for opening windows using windowFeatures on that page.
Cheers
Andy