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
https://forums.phpfreaks.com/topic/57755-solved-iframe-string-transfer/
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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.