Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Connecticut, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Maximize a Window I Open with a Form Button

    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'

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    Connecticut, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah. Great help. The purpose of this forum is for people to get help, not to be told "search for it yourself..."

    Can anyone provide an intelligible answer?

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fine....if that's how you wanna be about it
    Code:
    <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')">

  • #5
    New Coder
    Join Date
    Aug 2002
    Location
    Connecticut, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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??????????????????

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Code:
    var h = screen.height;
    var w = screen.width;
    Or just use the fullscreen attribute, but this may piss users off
    Code:
    window.open(nURL,'NewWin','fullscreen');
    Sorry, no 'maximize' capability, unless someone can prove me wrong.
    Last edited by beetle; 08-06-2002 at 09:37 PM.

  • #7
    New Coder
    Join Date
    Aug 2002
    Location
    Connecticut, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah. I really can't believe there's no maximize script. Thanks for the script though. I use IE btw.

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    put this in your new window page email.html

    Code:
    <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>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #9
    New Coder
    Join Date
    Aug 2002
    Location
    Connecticut, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks people. I'll give it a try.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •