Jump to content

[SOLVED] IFRAME string transfer?


Salis

Recommended Posts

Ok, I'm building an editor for my site. Nothing super great. I have an IFRAME and in the IFRAME is image list and uploader.

 

What I need help on is sending a string from the IFRAME to the parent window. The idea is to upload files though the frame and also list them in a drop down <select> box. So if I wanted to add an image, I'd go to the IFRAME, browse for my image, click upload the choose my image from the list and click add. After I click Add I need that <a> link to be sent to the textarea on the main parent page? How would I do that?

Link to comment
Share on other sites

Hi this might help you

 

the main page

<script type="text/javascript">
//funtion that sets the value in the showString Div
function showString(iframeVar){

document.getElementById('showString').innerHTML=iframeVar;
}
</script>
<div id="showString"></div>
<iframe src="iframe.html"></iframe>

 

iframe page

function transferString(){
var myIframeVar="this was send from the Iframe"
window.parent.showString(myIframeVar);

}
<button onclick="transferString()">
transfer string
<button>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.