PDA

View Full Version : Javascript to resize browser window


ExtraB
29-10-2003, 13:38/01:38PM
Hello

Is it possible to use the OnLoad attribute in an html documents body tag in order to change the current browser's window?

Any idea what the code is or where I can see an example online?

I was able to do this for a popup window... here is the code

</head>
<script language="JavaScript">
<!--
function open_new_window(url)
{
new_window = window.open(url,'window_name','toolbar=0,menubar=0,resizable=0,dependent=0,status=0,width=780,height=500,left=25,top=25')
}
// -->
</script>
</head>

<body bgcolor="#FFFFFF" onload="javascript:window.open('testing.htm', 'newwindow', 'HEIGHT = 500, WIDTH = 780, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, left=25, top=25')">

I want to use the same settings for a browser window but I don't want to pop up a new window... I just want to have the current window resize and change its properties.

Is this possible?

How can the above code be tweeked to accomplish this?

Thanks

Eric B

JuniorHarris
29-10-2003, 15:19/03:19PM
Can you use window.resizeTo(x,y), where x and y are the sizes you want?
Note, being sure to use proper case for JavaScript.

ExtraB
29-10-2003, 16:44/04:44PM
Actually I am using this as a quick fix for now...

<script language="JavaScript">
window.resizeTo(600,600);
</script>

The problem is it sets the size of the whole browser window...

I read something at Dev Shed and posted there too...


----------

this is the code I am using but its not working I am sure there is a mistake with it....


<html>
<head>
<title>Inner Settings</title>
<script language="JavaScript">
<!--
function SetInner(width,height)
{
window.innerWidth = width
window.innerHeight = height
}
// -->
</script>
</head>

<body bgcolor="#000066" onload="javascript:window.SetInner(400,500)">

here is the thread (http://forums.devshed.com/showthread.php?s=&postid=419878#post419878)

If anyone can tell me what is wrong with my code and if I am doing it right or not that would be greatly appreaciated.

Thanks
Eric B