Jump to content

[SOLVED] Passing info to the parent window


TEENFRONT

Recommended Posts

Hey everyone,

 

I am currently half way through creating a new article manager to manage my site reviews etc. I have ben working hard and over the past 24 hours iv managed to do this ( + more but this is the important stuff )

 

Add-Review.php

This page has a "Click here to add image" link poping up add-image.php

 

Add-image.php

This page has a php upload image script, once an image has been uploaded, you press "Close" button and the uploaded file URL, Size, and other details, are passed back to the parent window ( add-review.php ) and are displayed in input text fields.

 

Im really wanting to ditch text fields and forms to just display the info, but i can only seem to find help with transfering values back to the parent window using forms and text fields, i just want plain text.

 

So question...

 

Is there a way to transfer text from a text box in the pop up window, to the parent window but in standard html..so i can use it for updating say.. a link tag, or an image tag etc.

 

Fank Yuuuu!!

Link to comment
https://forums.phpfreaks.com/topic/46296-solved-passing-info-to-the-parent-window/
Share on other sites

in the parent window:

URL: <span id="showurl"></span>

in the opened window:

<script>
    window.opener.document.getElementById('showurl').innerHTML = '**the url **';
</script>

have not tried it but it should work, tell me if it does.

 

Hi

 

Thats great, thanks alot for that. How would i go about updating the url of a a href tag or the src of an image tag? like...

 

<a href="transferred link">transferred title</a>   or
<img src="transferred image src" />

Solved!

 

Found a little javascript that does the trick. here it is if anyone else reads this!

 

<script langauge="javascript">
function movepic(img_name,img_src) {
opener.document[img_name].src=img_src;
}
</script>

 

When you run this function, it replaces the img src vale of img_name and updates the image on the page accordingly.

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.