IFRAME and the parent page

I have this page that contains a flash object that shows a map for a country with its cities as links,clicking on a city link is supposed to load text specific to each city in an ifram, so the target of each link is the ifram with a querystring parameter of the city name, what I'm asking about is there a way for the parent page the one that includes the ifram & the flash to access the querystring parameter passed to the ifram, cos there is a link on the parent page called photogallery which when clicked is supposed to load the photogallery of the city the user clicked on the map,so how can I know which city is clicked except from the parameter sent to the ifram.

Hope my problem is clear,thanks.
LVL 3
JessyEzzyAsked:
Who is Participating?
 
ThaSmartUnoConnect With a Mentor Commented:
in your iframe page you could add
<script type="text/javascript">
opener.setCity(location.search.substr(1));
</script>

and in your main page (with the iframe and flash)
have
<script type="text/javascript">
 var tcity='';
 function setCity(city){ tcity=city };

 function showImage(){
  window.location.href="/myimages/photogallery.asp?"+city;
 }
</script>

and your link to load photogallery
<a href="#" onclick="showImage(); return false;">Photogallery</a>
0
 
JessyEzzyAuthor Commented:
Where am I'm supposed to add the code in the ifram, and what does substr(1) refers to why 1 and not 0?

Thanks.
0
 
ThaSmartUnoCommented:
substr(1) because location.search = "?" & querystring
so substr(1) gives you querystring

so im assuming your iframe gets a url like openpage.asp?somecity ... or
openpage.asp?city=somecity

and anywhere (easiest would just be at the top)
0
 
JessyEzzyAuthor Commented:
Thanks it's done, but I used window.parent.setCity instead of opener cos it gave me an error.
0
 
ThaSmartUnoCommented:
ok well glad that worked =)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.