473,625 Members | 2,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 19505
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.co mwrote:
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.co mwrote:


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.getEle mentById("mydiv ").style.displa y = "none";
}
</script>

<div id='mydiv'>
<iframe src='myiframe.h tm'>

</iframe>
</div>

--myiframe.htm--
<script>
function AskParentToHide Me()
{
if (typeof(parent. hideIFrame)=='f unction') parent.hideIFra me();
}
</script>
<input type='button' value='Hide This IFrame'
onclick=AskPare ntToHideMe();">

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.co mwrote:
On Feb 7, 10:38 am, "Jayyde" <mirax...@yahoo .comwrote:


On Feb 6, 4:18 pm, "Adambrz" <Adam...@msn.co mwrote:
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.getEle mentById("mydiv ").style.displa y = "none";}

</script>

<div id='mydiv'>
<iframe src='myiframe.h tm'>

</iframe>
</div>

--myiframe.htm--
<script>
function AskParentToHide Me()
{
if (typeof(parent. hideIFrame)=='f unction') parent.hideIFra me();}

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

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

Hope that helps,
Adambrzwww.adam brz.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
9297
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 load content in the middle. I would like, if possible, to have the parent window resize itself to suit whatever is loaded into the iframe container, deriving the size needed from calculated values. Thus the calculation would have to over-ride...
6
14386
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
11561
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
7
1393
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
6006
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 code is in C#/ASP.NET. TIA. Andrew.
9
6833
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
9373
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 can use it there. Thanks in advance :) Paul
15
62034
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
26609
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 using this code but I did something wrong because the temp function is fired every time the parent page loads: function temp(){ alert('the iframe was closed'); }
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6115
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.