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:55
Opening In new window javascript help
Poster: valkyrie258
Dated: Saturday November 22 2003 - 2:50:41 GMT
who knows how to make change this code so i can put the options resize, toolbar, status etc. on/off
Code:
"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>
--------------------------------------------------------------------------------
<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: kevin3442
Dated: Wednesday November 26 2003 - 0:58:48 GMT
The capabilities are already built into the openNewWindow() function. The 4th parameter (winConfig) is an additional string of comma-separated window attribute settings that get passed to the window.open() method. You're already using it to set scrollbars=yes. If you want to set additional options, simply add them to the string, separating each option from the next with a comma. For example, if you want to make your new window so that it isn't resizable, you'd include resizable=no in the string, like this:
Code:
"News","javascript:openNewWindow(\"news.htm\",310,350,\"scrollbars=yes,resizable=no\") onbackcolor=55bbff;offbackcolor=ff0000;",,"PopUp News",1
There are many references to the javascript window.open() method on the web, where you can find out what other window attributes are available and what their possible settings are. Here is a good place to start.
Hope that helps,
Kevin