www.webdeveloper.com
Results 1 to 9 of 9

Thread: Resizable feature not working with window.open

  1. #1
    Join Date
    Apr 2008
    Posts
    134

    Resizable feature not working with window.open

    I created a simple form that will allow you to open a url in a new window after clicking on the provided button. That part works but I'm unable to resize the new window

    http://goken68.brinkster.net/OpenNewWindow.html

    Code:
    <html>
    <head>
    <title>Opening a New Window</title>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Hide script from non JavaScript Browsers
    
    function openWindow()	{	
    var url=document.forms1.urlName.value;
    var h=document.forms1.height.value;
    var w=document.forms1.width.value;
    window.open(url, h, w, resizable="yes");
    }
    
    //End of hiding script-->
    </SCRIPT>
    </HEAD>
    
    <BODY BGCOLOR="#00CC00" TEXT="#000000">
    <FORM NAME="forms1">
    <P>Please enter the name of the url you wish to access:<br>
    <P><INPUT TYPE="text" NAME="urlName" SIZE="50"><br>
    
    <p>Enter the height of the window:<br>
    <P><INPUT TYPE="text" NAME="height" SIZE="10"><br>
    <p>Enter the width of the window:<br>
    <p><INPUT TYPE="text" NAME="width" SIZE="10"<br>
    
    
    <P><INPUT TYPE="button" NAME="button1" value="Open New Window" 
    
    onClick="openWindow()">
    
    
    
    
    <P><INPUT TYPE="reset" VALUE="reset">
    </FORM>
    
    </BODY>
    
    </HTML>

  2. #2
    Join Date
    Sep 2006
    Location
    new york
    Posts
    265

    pair of "quotes" around features

    This is an old script of mine
    Code:
    // separate window for link    
     
        function myopen(url)
        { window.open (url, 'links', 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=auto,resizable=yes,dependent=yes,width=400,height=400'); window.blur();
    	    }
    		var links; //to avoid "undefined" message
    //  JavaScript Unleashed's onUnload event handler
            function clean() { 
              if (links != null) { links.close() }; 
            }
    Notice all the features are inside single pair of 'quotes' -- so try "resizable=yes"
    Last edited by auntnini; 04-16-2012 at 05:30 PM.

  3. #3
    Join Date
    Apr 2008
    Posts
    134
    I changed it to "resizeable=yes" but that didn't fix it. Still can't resize the window.

  4. #4
    Join Date
    Apr 2008
    Posts
    134
    Also, it seems like no matter what value I enter for height and width, the size of the window that opens is always the same.

  5. #5
    Join Date
    Mar 2011
    Posts
    1,133
    The window.open function in your post above is not passing the parameters properly. You're missing the value for the window name and the chroma needs to be contained in a single string, so none of the rest of the values are being parsed properly. Look at auntnini's example above and try again.
    Rick Trethewey
    Rainbo Design

  6. #6
    Join Date
    Apr 2008
    Posts
    134
    The resizable feature works, but still, no matter what value is entered for height and width, the window that opens is always the same size.

    http://goken68.brinkster.net/OpenNewWindow.html

    Code:
    <html>
    <head>
    <title>Opening a New Window</title>
    <SCRIPT LANGUAGE="JavaScript"> 
    <!-- Hide script from non JavaScript Browsers
     
    function openWindow()	{	
    var url=document.forms1.urlName.value;
    var newWindow;
    var h=document.forms1.height.value;
    var w=document.forms1.width.value;
    window.open(url, 'newWindow', 'resizable=yes,h,w');
    }
     
    //End of hiding script-->
    </SCRIPT>
    </HEAD>
     
    <BODY BGCOLOR="#00CC00" TEXT="#000000">
    <FORM NAME="forms1">
    <P>Please enter the name of the url you wish to access:<br>
    <P><INPUT TYPE="text" NAME="urlName" SIZE="50"><br>
     
    <p>Enter the height of the window:<br>
    <P><INPUT TYPE="text" NAME="height" SIZE="10"><br>
    <p>Enter the width of the window:<br>
    <p><INPUT TYPE="text" NAME="width" SIZE="10"<br>
     
     
    <P><INPUT TYPE="button" NAME="button1" value="Open New Window" onClick="openWindow()">
     
     
     
     
    <P><INPUT TYPE="reset" VALUE="reset">
    </FORM>
     
    </BODY>
     
    </HTML>

  7. #7
    Join Date
    Mar 2011
    Posts
    1,133
    The chroma is still malformed. Try:
    Code:
    window.open(url, 'newWindow', 'resizable=yes,width=' + h + ',height=' + w);
    Rick Trethewey
    Rainbo Design

  8. #8
    Join Date
    Apr 2008
    Posts
    134

    resolved

    Thank you.

  9. #9
    Join Date
    Apr 2008
    Posts
    134

    resolved [resolved]

    Resolved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles