PDA

View Full Version : window.open()


alaios
08-10-2002, 09:46 PM
we have two html files :
1.htm and 2.htm
From 1.htm we can open in to a new window the 2.htm using window.open
And now my question how we can change the properties of the 2.htm from the 1.htm?
For example i want to have a button in 1.htm which can change the size of 2.htm.
Can u help me?

chucktcl
08-10-2002, 09:58 PM
If you go here http://www.wsabstract.com/script/cut41.shtml you'll be able to customize your second window.

chuck

kansel
08-11-2002, 01:36 AM
alaios -

In 1.htm (the "parent" window)


<script>
var win2 = window.open();
</script>
<a href="javascript:win2.resizeTo(300,200)">resize window 2</a>


If win2 (the "child" window) is declared as a global variable you can control it freely, otherwise you may have to pass the win2 variable to your controller functions.

alaios
08-11-2002, 08:41 AM
window.open('1.htm',name="idontknow",attributes);
where do we use the name of thw window (idontknow)

mordred
08-11-2002, 03:10 PM
We? You've got multiple personalities? ;) j/K


window.open('1.htm', "idontknow", attributes);


Of course attributes must be a variable containing the windows variables like height, width etc..., but I suppose you meant it this way and know already about.

whackaxe
08-11-2002, 03:51 PM
i find it simpler to make a function to open windows

function openwin()
{thewin = open("2.html", "whocares","scrollbars=no")}

then by using

thewin.window

or whatever you are in the root of the child pages js hierarchy
and vice vera is

opener.window you are in the root of the parent doc