473,324 Members | 2,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Event control between iFrame and parent window

Is there any way to capture a button click inside an iFrame and
perform both an action on that page and one on the parent page?

Basically I have a page atm that allows the user to add a record to a
table and what I would like to have are save and cancel buttons (or
maybe just a save button with a close image on the DHTML "window") on
the page that, when save is clicked for instance, will save the record
(code in that page) and close the DHTML window (code in the parent
page).

Any help would be greatly appreciated--I can't find anything in
searching that is quite the same as this :).

TIA,
Jayyde

Feb 6 '07 #1
4 19483
On 6 Feb, 13:26, "Jayyde" <mirax...@yahoo.comwrote:
Is there any way to capture a button click inside an iFrame and
perform both an action on that page and one on the parent page?

Basically I have a page atm that allows the user to add a record to a
table and what I would like to have are save and cancel buttons (or
maybe just a save button with a close image on the DHTML "window") on
the page that, when save is clicked for instance, will save the record
(code in that page) and close the DHTML window (code in the parent
page).

Any help would be greatly appreciated--I can't find anything in
searching that is quite the same as this :).

TIA,
Jayyde
Can you give an image of your layout to help understand your plan.

Feb 6 '07 #2
On Feb 6, 4:18 pm, "Adambrz" <Adam...@msn.comwrote:
On 6 Feb, 13:26, "Jayyde" <mirax...@yahoo.comwrote:
Is there any way to capture a button click inside an iFrame and
perform both an action on that page and one on the parent page?
Basically I have a page atm that allows the user to add a record to a
table and what I would like to have are save and cancel buttons (or
maybe just a save button with a close image on the DHTML "window") on
the page that, when save is clicked for instance, will save the record
(code in that page) and close the DHTML window (code in the parent
page).
Any help would be greatly appreciated--I can't find anything in
searching that is quite the same as this :).
TIA,
Jayyde

Can you give an image of your layout to help understand your plan.

Here's a screenie of an example of what I'm trying to do.

http://i59.photobucket.com/albums/g3...p_screenie.png

There're 2 save buttons on there: the one on the iFrame page that's an
actual button, and the one in the div's title bar that's an image. I
don't really care which I use (I'd prefer just one or the other, not
both like I have it mocked up atm). Whichever one is easier to
accomplish my objective from is fine. I need it to do the following:

- Fire off a javascript function in the parent page
- Fire off an AJAX-ed ASP.NET method on the iFrame's src page
- Fire off an AJAX-ed ASP.NET method on the parent page

Feb 7 '07 #3
On Feb 7, 10:38 am, "Jayyde" <mirax...@yahoo.comwrote:
On Feb 6, 4:18 pm, "Adambrz" <Adam...@msn.comwrote:


On 6 Feb, 13:26, "Jayyde" <mirax...@yahoo.comwrote:
Is there any way to capture a button click inside an iFrame and
perform both an action on that page and one on the parent page?
Basically I have a page atm that allows the user to add a record to a
table and what I would like to have are save and cancel buttons (or
maybe just a save button with a close image on the DHTML "window") on
the page that, when save is clicked for instance, will save the record
(code in that page) and close the DHTML window (code in the parent
page).
Any help would be greatly appreciated--I can't find anything in
searching that is quite the same as this :).
TIA,
Jayyde
Can you give an image of your layout to help understand your plan.

Here's a screenie of an example of what I'm trying to do.

http://i59.photobucket.com/albums/g3...t_group_screen...

There're 2 save buttons on there: the one on the iFrame page that's an
actual button, and the one in the div's title bar that's an image. I
don't really care which I use (I'd prefer just one or the other, not
both like I have it mocked up atm). Whichever one is easier to
accomplish my objective from is fine. I need it to do the following:

- Fire off a javascript function in the parent page
- Fire off an AJAX-ed ASP.NET method on the iFrame's src page
- Fire off an AJAX-ed ASP.NET method on the parent page- Hide quoted text -

- Show quoted text -

I would start by getting rid of the iframe but you are the one design
not me I will help you the way you requested. You can have the Iframe
do its own thing and on Save(submit of form) it sends the variables to
a server-side script to save the data. at the end of that serverside
you could have a javascript line that states:

exerpt from(http://www.experts-exchange.com/Web/Web_Languages/
JavaScript/Q_21501305.html)

--mydiv.htm--
<script>
function hideIFrame()
{
document.getElementById("mydiv").style.display = "none";
}
</script>

<div id='mydiv'>
<iframe src='myiframe.htm'>

</iframe>
</div>

--myiframe.htm--
<script>
function AskParentToHideMe()
{
if (typeof(parent.hideIFrame)=='function') parent.hideIFrame();
}
</script>
<input type='button' value='Hide This IFrame'
onclick=AskParentToHideMe();">

Since the serverside runs before client-side you should get your
change to database while also making the div hide.

Hope that helps,
Adambrz
www.adambrz.com

Feb 9 '07 #4
On Feb 9, 1:49 pm, "Adambrz" <Adam...@msn.comwrote:
On Feb 7, 10:38 am, "Jayyde" <mirax...@yahoo.comwrote:


On Feb 6, 4:18 pm, "Adambrz" <Adam...@msn.comwrote:
On 6 Feb, 13:26, "Jayyde" <mirax...@yahoo.comwrote:
Is there any way to capture a button click inside an iFrame and
perform both an action on that page and one on the parent page?
Basically I have a page atm that allows the user to add a record to a
table and what I would like to have are save and cancel buttons (or
maybe just a save button with a close image on the DHTML "window") on
the page that, when save is clicked for instance, will save the record
(code in that page) and close the DHTML window (code in the parent
page).
Any help would be greatly appreciated--I can't find anything in
searching that is quite the same as this :).
TIA,
Jayyde
Can you give an image of your layout to help understand your plan.
Here's a screenie of an example of what I'm trying to do.
http://i59.photobucket.com/albums/g3...t_group_screen...
There're 2 save buttons on there: the one on the iFrame page that's an
actual button, and the one in the div's title bar that's an image. I
don't really care which I use (I'd prefer just one or the other, not
both like I have it mocked up atm). Whichever one is easier to
accomplish my objective from is fine. I need it to do the following:
- Fire off a javascript function in the parent page
- Fire off an AJAX-ed ASP.NET method on the iFrame's src page
- Fire off an AJAX-ed ASP.NET method on the parent page- Hide quoted text -
- Show quoted text -

I would start by getting rid of the iframe but you are the one design
not me I will help you the way you requested. You can have the Iframe
do its own thing and on Save(submit of form) it sends the variables to
a server-side script to save the data. at the end of that serverside
you could have a javascript line that states:

exerpt from(http://www.experts-exchange.com/Web/Web_Languages/
JavaScript/Q_21501305.html)

--mydiv.htm--
<script>
function hideIFrame()
{
document.getElementById("mydiv").style.display = "none";}

</script>

<div id='mydiv'>
<iframe src='myiframe.htm'>

</iframe>
</div>

--myiframe.htm--
<script>
function AskParentToHideMe()
{
if (typeof(parent.hideIFrame)=='function') parent.hideIFrame();}

</script>
<input type='button' value='Hide This IFrame'
onclick=AskParentToHideMe();">

Since the serverside runs before client-side you should get your
change to database while also making the div hide.

Hope that helps,
Adambrzwww.adambrz.com- Hide quoted text -

- Show quoted text -
Thanks for the help! :)

I don't think there is any way I can get away from using an iFrame,
since on that page (and another) there are mulitple Add New links like
the one I showed in the screenie. Each needs to have a slightly
different src on the iFrame (actually the same page, but different
data in the post). So it's not a static src, otherwise, yeah I just
wouldn't use an iFrame.

Feb 11 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Catherine Lynn Smith | last post by:
I want to know the recommended way to handle scripting of/with containers such as an iframe. I have a page with border-navigation bars on the top/bottom/left/right and I want to use an iframe to...
6
by: Wendi | last post by:
If i have an iframe from within an HMTL document: Iframe.htm: ------------------------------ <html> <head> <title>Iframe.htm</title> </head> <body> <iframe src="sample.htm"></iframe>
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
7
by: sunil philip | last post by:
How do i identify the page that fired a method? e.g. page1.html ----------- <Head> <script> document.write(myfun()); </script>
10
by: Andrew | last post by:
Hi, I have a messagebox that pops up due to an event. I did it in javascript. ie. alert("Time's up. Assessment Ended"); I want to capture the OK and Cancel events of this alert messagebox. My...
9
by: mike | last post by:
I have this script executing <script> function mike_test(event) { x = window.event.clientX; alert(x); } </script> <iframe src="blank.html" id="my_iframe1"> </iframe>
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
15
by: Oleg Subachev | last post by:
I need to programmatically invoke from other class Click event of the Button on my Form. Button.OnClick method is protected, not public. How to perform this ? Oleg Subachev
4
by: Mike Scirocco | last post by:
I have an iframe that includes a button: <input type="button" value="close this window" onclick="window.close();" > I would like to detect the iframe close event from the parent window, I was...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.