• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 459
  • Last Modified:

Trying to pass querystring from Iframe within parent base onclick!!

I have a updatedoctor1.asp where I call on an Iframe and I populate the Iframe with all of my images I pulled down from a folder. What I trying to do is when a user clicks on a certain image I would pass the name of the image into a text box I would then pass back to my table. What's happen is I'm having problems passing the name back to the updatedoctor1.asp  page.

What I thought would work was onclick="PopulateTextBox('<% response.write(s)%>')"><img src="<% response.write(lcVariable)%>">

<script language="JavaScript">
   function PopulateTextBox (lcInvValue){
     var name = lcInvValue;
      document.myform.myTextBox.value = name;

I'm not sure how or where to place myTextBox in order to get the Name value.

The Iframe is in a document call updatedoctor1.asp
<td colspan="3"><iframe width=100% height="100" src="smalllistimages.asp" align=left  frameborder=0 hspace=0 vspace=0 name="ImagesView" > </iframe></td>

1 Solution
Saqib KhanSenior DeveloperCommented:
if the Textbox is in main document then update its content by doing this

parent.document.myform.myTextBox.value = name;
(Means myTextBox is a textbox within main Document, and you clicked on the image within IFRAME).

and to update something within IFRAME from main document then

document.myFrame.myform.myTextBox.value = name;
(Where myFrame is the name of IFrame and text box is within IFRAME).

Good Luck
DstathakisAuthor Commented:
Thank You it worked!!

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now