INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Changing the default icon

How can I customize how a new window looks? by RISTMO
Posted: 26 Jun 02 (Edited 7 Oct 02)

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 .

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:open_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

Back to HTML, XHTML & CSS FAQ Index
Back to HTML, XHTML & CSS Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close