...

View Full Version : Maximize a Window I Open with a Form Button



TranceNational
08-06-2002, 07:30 PM
I'm opening a new window with a form button (see script below). But the window is small when it opens. Does anyone know how to make the window maximize upon opening? Thanks.

<form name="winform">
<input type="button" class="fButton" value="Email" onClick="NewWin=window.open('email.html','NewWin';)

beetle
08-06-2002, 07:45 PM
Well, you can't activate the 'maximized' status of the window per se, but you can have your onClick() event call a function that sizes the window to the user's screen size. There are tutorials/scripts for this all over the place.

TranceNational
08-06-2002, 08:26 PM
Yeah. Great help. The purpose of this forum is for people to get help, not to be told "search for it yourself..." :rolleyes:

Can anyone provide an intelligible answer? :confused:

beetle
08-06-2002, 08:43 PM
Fine....if that's how you wanna be about it :D
<script language="javascript" type="text/javascript">

function showMaxWin(nUrl)
{
var h = screen.availHeight;
var w = screen.availWidth;
var features = "width="+w+", height="+h+",top=0,left=0";
NewWin=window.open(nUrl,'NewWin',features);
}

</script>

<input type="button" class="fButton" value="Email" onClick="showMaxWin('email.htm')">

TranceNational
08-06-2002, 10:22 PM
I couldn't seem to get it to work properly. I tried a few different solutions I found and they all don't maximize the window properly (to normal maximization) and they mess up my browser.

I can't believe there's no script or tag to maximize a fu(king window. Are we living in the dark ages??????????????????

beetle
08-06-2002, 10:34 PM
What browser are you using? I just tested it ok here.

Uhhh, availWidht and availHeight are IE only I think. Change them to just width and height
var h = screen.height;
var w = screen.width;
Or just use the fullscreen attribute, but this may piss users off
window.open(nURL,'NewWin','fullscreen');Sorry, no 'maximize' capability, unless someone can prove me wrong.

TranceNational
08-07-2002, 12:38 AM
Yeah. I really can't believe there's no maximize script. Thanks for the script though. I use IE btw.

glenngv
08-07-2002, 03:37 AM
put this in your new window page email.html



<head>
<script language="javascript">
function autoMax(){
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}

window.onload=autoMax;

</script>
</head>

TranceNational
08-07-2002, 04:43 AM
Thanks people. I'll give it a try.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum