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

Resize window onLoad 1

Status
Not open for further replies.

TAMSIN

Programmer
Sep 6, 2000
31
GB
Hi,
I know I can open a window with certain features using:
window.open(test.htm,'','scrollbars=yes,resizable=no,width=200,height=200')

but is it possible to just have a normal link to a page (ie. A HREF="test.htm" target="_blank") and then the file has some sort of onLoad event where it automatically resizes its own window?

Thanks for any help
Tamsin [sig][/sig]
 
This works on IE and NN (newer versions of each)...

Code:
<html>
<head>
<script>
 function fnResize(){
  var wWidth = 300;
  var wHeight = 300;
  window.resizeTo(wWidth,wHeight)
 }
</script>
</head>
<body onLoad=&quot;fnResize()&quot;>
 blah blah blah
</body>
</html>

Hope this helps,
Rob [sig][/sig]
 
Thanks, that worked (its not in my javascript reference though - guess I'm out of date!)

Do you know if there are similar ways to set the other things you can set with window.open? i.e. toolbar,location,menubar,scrollbars?

Thanks
Tamsin [sig][/sig]
 
Sorry but there isn't any direct way. You'll need to open the window the way you want to view it. You can, however move it (at least in IE) using moveBy(+-pxX,+-pxY) moveTo(X,Y) and there is also resizeBy(+-pxX,+-pxY).

Hope this helps,
Rob [sig][/sig]
 
Rob,
Those tips were very helpful, maybe you can answer this one...

The example you gave work correctly in a normal window, however, I tried the same thing with a window containing frames and could not get it to work. Do you have a tip or an idea why that would be?

Thx in advance,
Joe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top