PDA

View Full Version : Controlling Window Size



serendipity
07-03-2003, 03:52 AM
The attached javascript below, slowly opens a new window when the link is clicked. I've managed to figure out how to control the "positioning" of where the window starts to "appear" & spread out...however, I need help figuring out how to control the size...say i want the window to open with only a width of 200 and height of just 200. And yeah, it wouldn't hurt either if the "speed" of "spreading" can also be managed...

---------------------------------------------------------------
<body>

<script>

var mylocation="open_window.html"
var winheight=100
var winsize=100
var x=5

function go(){
win2=window.open("","","scrollbars")
if (!document.layers&&!document.all){
win2.location=mylocation
return
}
win2.resizeTo(100,100)
win2.moveTo(100,150)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=mylocation
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}
</script>
<a href="javascript:go()"
onMouseover="window.status='open window';return true" onMouseout="window.status=''">

<p>Open window</a> </p>

</body>

A1ien51
07-03-2003, 04:00 AM
Change the size here

win2.resizeTo(100,100)

change the speed here

setTimeout("go2()",50)

A # < 50 would be faster

serendipity
07-03-2003, 09:29 PM
Originally posted by A1ien51
Change the size here

win2.resizeTo(100,100)

change the speed here

setTimeout("go2()",50)

A # < 50 would be faster

Thanks, but i don't think that did the trick for me...although im a bit puzzled coz it seemed fairly obvious that it might...

the win2.moveTo <--adjusted the positioning, i thought there's a good chance the resize would be it...

A1ien51
07-04-2003, 08:17 AM
this is another area

winheight=100
winsize=100

if you are looking only for the max to be 200 then you would have to change the width property