...

View Full Version : Call a function in parent window from child window



Basscyst
10-16-2003, 09:21 PM
How do / Can you call a function in the parent window from a child window that I've opened with window.open?

like:

onclick="parent.myFunction();"

TIA

Basscyst

sciguyryan
10-16-2003, 09:24 PM
Yes, that is exactly right and, you got it first time - not like me!

Basscyst
10-16-2003, 09:43 PM
That doesn't seem to work though. This is the code I have:

<script language="javascript">
function testIt()
{
alert();
}

myWindow=window.open("","myWindow","status=no,location=yes,toolbar=yes,directories=no,resizable=yes,width=600,height=400,top=100,left=10 0,scrollbars=yes");
myWindow.document.open();
myWindow.document.writeln("<center><table border=1 bgColor=C3DEF1 style='text-align:center;'><tr><td><b>Shift Time<td><b>Date<td><b>Name<td><b>ID<td><b>Time Requested</b></td></tr></table><br><input type='button' value='Mark As Logged' onclick=javascript:parent.testIt();>");
</script>

sciguyryan
10-16-2003, 09:48 PM
hmm, odd i cant even get access to the file - I will see what i can do.

liorean
10-16-2003, 09:52 PM
In the case of popups instead of frames: parent --> opener

Basscyst
10-16-2003, 09:55 PM
Thank You Kindly. That did the trick!!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum