Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in window resizing on Loading

 
smitha rai
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this instead
place in the head tag
<script>
self.moveTo(0,0);
self.resizeTo('400','600');
</script>
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Goto this page, it will do the work for you
http://www.a1ien51.8k.com/scripts/popupwingenV2.htm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic