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

Maximize window function doesn't work right 2

Status
Not open for further replies.

xsw1971

Programmer
Jun 21, 2001
153
US
I am using the following script in all of my pages in order to have a screen that is maximized when it is opened:

<script>
function maXimize()
{
window.moveTo(0,0)
window.resizeTo(screen.width,screen.height)
}
</script>

The problem is that, while it does fill the screen, it doesn't completely maximize (like it does when you click the box in the upper right corner), and it covers the user's task bar at the bottom (even though the task bar is NOT on autohide, and it says to always display on top.)

Once open, if the user clicks the actual maximize button on the browser, it truely maximizes the window AND the taskbar is displayed again.

Any ideas how to fix this? (ps, I don't know JavaScript so I need help with syntax.) Thanks!
 
You can't &quot;truly&quot; maximise the window using javascript. What you are already doing is pretty much the best you can achieve. If you're worried about the task bar being hidden, you could shorten the maximised window a bit using

window.resizeTo(screen.width,screen.height-20);

Greg.

 
Thanks Greg, that's exactly what I was looking for!
 
JennieM, thanks for the moveTo and resizeto script, I needed something similar to that and you saved me time from coding it...
:D You get a star...LOL I have not failed; I merely found 100,000 different ways of not succeding...
 
Hi JennieM,

This version of the script is even better.

<script language=&quot;JavaScript&quot;>
<!--

self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);

//-->
</script>

I like this version better because it makes JavaScript
do less calculations. This is very important when your
site heavily relies on JavaScript.

I hope this helps,
BobbaFet

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
<script language=&quot;JavaScript1.2&quot;>
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;
}
}
</script>

THIS WORKS !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top