472,988 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Passing a value from the parent to the iframe

Jim
I want to pass a value from the parent to the iframe when I click a
button, the parent will reload and the iframe should show the data I
need...

when the iframe loads I want it to run something in asp based on the
value I send it..how can I go about doing this?

thanks

-Jim
Jul 23 '05 #1
2 2739
Jim wrote:
I want to pass a value from the parent to the iframe when I click a
button, the parent will reload and the iframe should show the data I
need...
Strictly speaking, the page in which the iframe resides and the iframe
are siblings. When you reload the "parent", you start from scratch, any
value of variables you may have set after the original page load will
be lost.
when the iframe loads I want it to run something in asp based on the
value I send it..how can I go about doing this?
Instead of reloading you could attach a query string to the location:

location=(location.toString())+"?Name="+var1+"&Ran k="+var2;
And use asp or js to parse the query string.

Mick

thanks

-Jim

Jul 23 '05 #2
> I want to pass a value from the parent to the iframe when I click a
button, the parent will reload and the iframe should show the data I
need...

Be sure to use window.frames["frame name"] to access the iFrame. This
access property will give you the window object of the iFrame and
should work in all browsers. IE also exposes properties directly off
the iFrame element but I suggest avoiding them as they are mostly
unsupported by other browsers.

If your iFrame is named ifTest ( <iframe name='ifTest'... )the you can
get the window object of the iFrame by var w=window.frames["ifTest"].
Have your JS event set the window.location.href of the iFrame to the
URL you want including the proper query parameters in the get. Your
ASP page receiving the request would parse the query parameters from
the get and do whatever you wish.

Hope this helps,

JsD
Jul 23 '05 #3

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

Similar topics

2
by: Xerxes | last post by:
Hi, how can I pass the returned value from Javascript to PHP? I have: ------------------------------------------------------------------------ ------ if ( x>y) {
5
by: Lee | last post by:
I am using a modal window and an iFrame to try and pull a return value back. I am doing this across domains. I have the value returned from the modal window to the iFrame window but I can not...
4
by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then...
11
by: HolaGoogle | last post by:
Hi, Sorrryy to ask such basic question but i do need your help! Here's what i'm trying to do: In my parent form i'm calling a my Iframe form to get certain value, then depending on that value...
3
by: hendedav | last post by:
Hi gang. As with any other post, I am working on a project and have gotten stuck. I am trying to obtain a variable value in the parent webpage from an <iframe>. For instance: Parent Page code...
3
by: Kieran Benton | last post by:
I'm trying to communicate between a parent document that is controlled through pure Javascript with an embedded IFrame containing an ASP.NET form. I can quite easily pass data into hidden fields in...
2
by: Yazeed_Roumer | last post by:
hi, i have an aspx page which contains i frame . this iframe contains a div which is editable div . after finish editting i need to have the content of this div in the codebehind of the parent...
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...
4
by: solomondg1 | last post by:
I want to send a variable from an iframe within a parent page to a swf on the parent page. The following code works: window.document.myflash.SetVariable('variable','value') (my flash is the name...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.