473,405 Members | 2,167 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,405 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 2780
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.