SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Calling parent window function
-
Jun 11, 2004, 00:35 #1
Calling parent window function
Parent window script
<script language="javascript">
function show()
{
msgwindow = open('Page2.htm','window','width=200,height=200');
msgWindow.opener = self;
}
function func2()
{
alert('function called from child window');
}
</script>
In my page2.htm file i have one button. Onclick of the button should invoke the function by name 'funct2()' which is present in the parent window. How do i call a parent window function from child window?
Thanks.
-
Jun 11, 2004, 06:36 #2
- Join Date
- Jun 2004
- Location
- Finland
- Posts
- 703
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<script language="JavaScript" type="text/javascript">
function show()
{
msgwindow = window.open('Page2.htm','window','width=200,height=200');
}
function func2()
{
alert('function called from child window');
}
show();
</script>
( To page2.htm: )
<input type="button" onclick="window.opener.func2()" value="Show funny alert">
Bookmarks