This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Problem in window resizing on Loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem in window resizing on Loading" Watch "Problem in window resizing on Loading" New topic
Author

Problem in window resizing on Loading

smitha rai
Ranch Hand

Joined: Aug 15, 2001
Posts: 33
I want to control the window size of my html or jsp page whenever first time the page is loaded. For example, I want to control window size for the page 'test.html' to 400(width) x 600(height). Please refer to the following my code. Please help me out where I did mistake.
Thanks adn regards,
Smitha
=================================================================
<html>
<head>
<script>
function setWindowSize() {
document.body.offsetWidth = "400";
document.body.offsetHeight = "600";
}
</script>
</head>
<body onLoad="setWindowSize()">
<form>
<b>This is the testing page for window sizing</b>
</form>
</body>
</html>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
try this instead
place in the head tag
<script>
self.moveTo(0,0);
self.resizeTo('400','600');
</script>
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"smitha_rai",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
Dave
smitha rai
Ranch Hand

Joined: Aug 15, 2001
Posts: 33
Hi,
Following is worked perfect. How fo I disable, the menubar and toolbar from the pop up window?
<script>
self.moveTo(0,0);
self.resizeTo('400','600');
</script>
Smitha
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Goto this page, it will do the work for you
http://www.a1ien51.8k.com/scripts/popupwingenV2.htm
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in window resizing on Loading
 
Similar Threads
not able to redirect to html file from a jsp
Parent-Child Windows(Urgent)
opening new window
TextArea in Javascript
Opening a child window