Opening In new window javascript help

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
valkyrie258
Beginner
Beginner
Posts: 9
Joined: Wed Nov 19, 2003 8:47 pm
Location: Rochester, New York
Contact:

Opening In new window javascript help

Post by valkyrie258 »

who knows how to make change this code so i can put the options resize, toolbar, status etc. on/off

Code: Select all

"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>
~Matt~
Http://wdtechzone.com - - - Best place for future web designers
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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: Select all

"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
Post Reply