View Full Version : Passing info from an opener to an iframe

Jul 25th, 2002, 03:52 PM
Hi guys,

I cant seem to get this thing to work. What i want to do is have javascript open a window with smiley images. Then i want the user to click on an image and when he/she does the window closes and the img src is passed back to an iframe on the main page. The name of the iframe is isContent.

Here is the code i have on the page that has the iframe...

function smiley()
smiley_img = showModalDialog("pop_rte_smiles.asp","","font-family:Verdana; font-size:12; dialogWidth:30em; dialogHeight:34em" );
if (smiley_img) {
var sel = idContent.document.selection.createRange();

and here is the code i have on the pop up smiley page

<script language="Javascript">
function insertsmilie(){
var img = window.event.srcElement
var src = img.src;
window.returnvalue= '<IMG border="0" align="absmiddle" src="' + src + '">';

Can someone please tell me how to fix it. What happens is the pop up opens, i click on a image, the window closes but nothing is passed to the iframe. PLZZZZ help :)



Mrs G
Jul 25th, 2002, 08:29 PM
not too sure at this moment but you could try putting the window.close() on a timeout so that the window closes a second after the script runs.

It could be the window is closed before the script can do all its work?

Jul 26th, 2002, 12:08 AM
Its ok, i got it to work, just a small coding error.....