window.open and margins

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Hi everybody,

Does anyone know if it's possible to define margins in a window.open function?
I've tried this already, but it does not work:

Win = open('cocktail.htm', '','width=400,height=397,marginwidth=0,marginheigth=0,toolbar=no,scrollbar=no,menubar=no,location=no,resizable=no,status=yes');

I know I can set the margins in the cocktail.htm-file but that's not what I want as the url in the window.open-function is going to be a variable.

Thanx in advanx,

Shakespeare: onclick || !(onclick)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

The window.open controls the browser window, not the contents other than putting a specific document *in* that window.

Your best bet is that if you need to have a variable going into the window is to write the "page" into the variable, with JavaScript.

So, document.write ('HI!'); et cetera.

hth,

Suzanne

They have: 21 posts

Joined: Nov 2000

Hi.

After you open the window, try something like this:

//open window named mywin
mywin = window.open(blahblah)...

//set mywin's body margin css property to 0
mywin.document.body.style.margin=0;

This worked for me in IE. For netscape you might have to do this:

mywin.document.body.margin = 0;

But I don't know if Netscape can handle it.

Jon.

Jon Steele -
EverySolution.com

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

thanx

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.