File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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