|
-
January 26th, 2006, 08:24 AM
#1
parent document question...
I created a form, that opens a new window with some more options...
now, once the user pushes a button on the newly opened window, I want some thins to happen in the main form window.
I know that if I want some values to change, all I need to do is :
parent.opener.document.getElementById("UserInput").value = usrValue;
now I wanna know, how to run a certain function on the main window, once a button on the new window was pushed???
thanks, gilly914
Rate this post if you found it useful!
10X, gilly914
-
January 26th, 2006, 10:41 AM
#2
Re: parent document question...
To my knowledge this is impossible. I do not have time to research it now but I can look into it after work. The only thing I have ever seen is working with objects from other windows, never actual JavaScript function calls from other windows. Sorry.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
January 26th, 2006, 10:57 AM
#3
Re: parent document question...
I just solved my problem, almost as usual, in a different way...
I just created a setInterval() to a function on the main window that checks if a certain flag is changed on the new window...
Than it knows when to activate...
Thanks for the help anyway...
Rate this post if you found it useful!
10X, gilly914
-
January 26th, 2006, 11:06 AM
#4
Re: parent document question...
Good thinking. I was thinking of using setTimeout but then I realized it couldn't be created dynamically. Then I thought to myself why not write it dynamically to a DIV?
Okay, here is another option... On the parent page create a DIV.
Code:
<div id="dynwrite" style="visibility:hidden"></div>
Now in the popup window write this...
Code:
<script language="JavaScript">
newhtmlline = "<script language='JavaScript'>";
newhtmlline = newhtmlline + "setTimeout('FUNCTIONNAME', 10);"
newhtmlline = newhtmlline + "</script>";
parent.opener.document.getElementByID('dynwrite').innerHTML = newhtmlline;
</script>
Last edited by peejavery; January 26th, 2006 at 11:09 AM.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
January 26th, 2006, 11:34 AM
#5
Re: parent document question...
Note that I edited my previous post and this will keep you from having to have an interval running and taking up resources.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
January 26th, 2006, 11:44 AM
#6
Re: parent document question...
WOW!...
Thanks alot! You always supply me with good and creative solutions...
Thanks peejavery
Rate this post if you found it useful!
10X, gilly914
-
January 26th, 2006, 12:24 PM
#7
Re: parent document question...
 Originally Posted by gilly914
WOW!...
Thanks alot! You always supply me with good and creative solutions...
Thank you too!
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
February 7th, 2006, 09:33 AM
#8
Re: parent document question...
This would look silly..
Keep a hidden button in the parent which calls a function on click.
Click this button from the popup.
as simple as that if u want it that way.
-
February 7th, 2006, 10:05 AM
#9
Re: parent document question...
 Originally Posted by amitvb
Keep a hidden button in the parent which calls a function on click.
Click this button from the popup.
Nice one. I tried the code below and it works nicely.
Code:
<input id="execbutton" type="button" value="Click Here" onclick="alert('It Worked!')" style="display:none">
<script language="JavaScript">
document.getElementById('execbutton').click();
</script>
One other thing, newer browsers even accept function calls between windows. I just found it and I never knew about it even though it seemed dumb to not work this way.
All you have to do is call the window's name and then the function.
Code:
windowname.window.function();
Sorry gilly914 for making that one hard on you.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|