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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I customize how a new window looks?

Changing the default icon

How can I customize how a new window looks?

by  RISTMO  Posted    (Edited  )
If you want to open a new window that has some "extra" customizable features, say no address bar or a certain width, you need to use javascript. Here's how:

Basic Syntax -- this will open the new window when you enter the page containing this script:

<SCRIPT type="Text/Javascript">
<!--
window.open("page.html","Window Title*2*","width=200,height=300,menubar=no,toolbar=no,directories=no,location=yes,scrollbars=no,resizable=no,status=yes");
//-->
</SCRIPT>

*******************IMORTANT******************************
Everything from the window.open (" to the end of the status=no"); must be on ONE line with no spaces.
*******************IMPORTANT*****************************

DEFINITIONS

Toolbar is the back, forward, stop, refresh, and home buttons.

Menubar is the file, edit etc. buttons at the very top.

You can guess what Scrollbars and Resizable are :-D.

Location is the address bar at the top.

Directories is where the bookmarks and stuff are.

Status is the bar at the bottom that displays messages (usually "done" or "page loaded").

OPEN WITH LINK
If you want to open the window when you click on a link, you'd do this:

<SCRIPT type="Text/Javascript">
<!--
function open_new_win(){
window.open("another_page.html","I'm a New Window","width=200,height=300,menubar=no,toolbar=no,directories=no,location=yes,scrollbars=no,resizable=no,status=yes");
}
//-->
</SCRIPT>

By doing this, you stop the window from opening automatically and you have to "call the function" to make the new window open. To call this function with a link, you'd do this:

<a href="javascript:eek:pen_new_win()">Open New Window!</a>

Now that it is a function it can be called with other event handlers: onLoad, onMouseOver, etc.


EXTRA SPECIAL TIP!
This is a special tip for IE 5.0+. With it, you can take off the blue title bar.

For this trick, you must do this:

<SCRIPT type="Text/Javascript">
<!--
var New_win=window.open("page.html","MyPage","fullscreen");
New_win.resizeTo(AnyWidthILike,AnyHeightILike);
//start option
New_win.moveTo(**x**,**y**);
// end optional
//-->
</SCRIPT>

You can take off the optional part above and everything will still work fine: the new window will be postioned at the top, left corner of the monitor. If you don't want that, just keep it in and change **x** to how far from the left side of your screen the left part of the window will be and **y** to how far down from the top of the screen the top of the window will be positoned.

Notice that here I have only fullscreen. All the other features are taken off when "fullscreen" is called. What fullscreen does, is it creates a new window that takes up the space of your whole computer monitor, leaving no space for the buttons, so they are always disabled, except for one strange one. For some reason, scrollbars are set to yes and adding scrollbars=no doens't fix that. If you want to fix that, you must put this in the body of the page being opened: style="overflow:hidden;".



Have fun making new customizable windows!

Rick Morgan
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top