Wrox Programmer Forums
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 14th, 2004, 12:33 AM
SoC SoC is offline
Authorized User
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default set size of window on load


I'm opening a new window(target= "_blank") from a submit button. I would like to be able to set the size of this new window.

I know how to do it with javascript on a standard hyperlink, but I'm not sure how to do it when using a submit button.

Can I set the size of the new page from within that new page?

That is, instead of setting the size using javascript on the parent page, you set the size of the child page from within the child page.

I hope that makes sense. Alternatively, is there a way of using the javascript with the submit button?


Old September 14th, 2004, 01:23 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi

Dear here is a java script function which will open a new window

function ak_help()
        showModalDialog(subdirectory + "help1.html", "", "dialogHeight:300px; dialogWidth: 400px; scroll: no; status: no; help: no;");

Love is the most precious thing of this world. So find it and grab it!
Old September 14th, 2004, 03:09 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post

Hi s,

You can do it with
window.resizeTo(xValue, yValue);


Old September 14th, 2004, 03:22 AM
SoC SoC is offline
Authorized User
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts


I worked out how to do it - I used window.resizeTo as ChrisScott also suggested.
Here's the code for anyone interested:

<script language="JavaScript">
function setSize(){
<body onLoad="setSize();">

Similar Threads
Thread Thread Starter Forum Replies Last Post
Customizing the window size tenvuong BOOK: Ivor Horton's Beginning Visual C++ 2005 0 March 31st, 2008 09:16 AM
set up image size goldenstate BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 4 February 15th, 2007 07:37 PM
Parse/Load/Search xml file size near about 1 GB sandeep_akhare XML 4 September 19th, 2006 04:47 AM
Window or Page size ckrajeshvarma ASP.NET 2.0 Professional 0 August 6th, 2006 12:53 AM
Window Size ckrajeshvarma ASP.NET 2.0 Basics 0 August 6th, 2006 12:50 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.