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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Charlottesville, US
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Making a window modal

    Does anyone know how I can bring up a modal window with a webpage that can control the size of the window? I have a webpage that uses javascript to resize itself but when I bring it up using showModalDialog the page doesn't resize itself.

    My objective is to bring up a page in a window that is modal but the window should be of specific size that can be controlled by the page that is being loaded and not by the page the page that is opening the modal window.

    I hope I have explained my problem well. I would appreciate a quick reply. Thanks everybody.

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Try This Out...

    Make two files...

    //start showModalChangeBrowserSize.html//
    <html>
    <head>
    <SCRIPT>
    <!--
    function doModal(url){
    var strWindowSize=showModalDialog(url,0,'dialogWidth:300px;dialogHeight:200px;resizable:yes;status:no');
    if (strWindowSize == -1 || strWindowSize == null)
    {
    alert('You clicked cancel or the close box');
    document.forms.frmModalTest.btnShowModal.value = 'Cancelled!';
    }
    if ((strWindowSize != -1) && (strWindowSize != ''))
    {
    //document.forms.frmModalTest.btnShowModal.value = strWindowSize;
    switch(strWindowSize)
    {
    case "640":

    window.resizeTo("640", "480");
    break;
    case "1280":
    window.resizeTo("1280", "1024");
    break;
    default:
    break;
    }

    }
    else
    {
    document.forms.frmModalTest.btnShowModal.value = 'Cancelled!';
    }
    }
    -->
    </SCRIPT>
    <body>
    <form name="frmModalTest">
    <input type="button" name="btnShowModal" value="Show Modal Window To Change This Window Size" onclick="doModal('ShowModalWindow.html')">
    </form>
    </body>
    </html>
    //end showModalChangeBrowserSize.html//

    //start ShowModalWindow.html//
    <HTML>
    <HEAD>
    <Title>Select Screen Size</Title>
    <SCRIPT>
    <!--
    function doOK()
    {
    window.returnValue=selChangeSize.value;
    window.close()
    }

    function doCancel()
    {
    // return a special known value if the user chooses cancel
    window.returnValue=-1;
    window.close();
    }
    -->
    </SCRIPT>
    </head>
    <BODY>
    Select The Values to change the Parent Window Size:
    <br>
    <select name="selChangeSize">
    <option value="640">640X480</option>
    <option value="1280">1280X1024</option>
    </select>
    <P><INPUT type=button onclick="doOK()" value=OK>&nbsp;
    <INPUT type=button onclick="doCancel()" value=Cancel></P>
    </BODY>
    </HTML>
    //ShowModalWindow.html//

    Hope that helps!

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could try the following:


    <SCRIPT LANGUAGE=JavaScript>
    window.resizeTo(600,400)
    </SCRIPT>


    This script would have to be placed in every page that was loaded into the window that requires a different window size.


  •  

    Posting Permissions

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