Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing info from an opener to an iframe

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

    Code:
    function smiley()
    	{
    	smiley_img = showModalDialog("pop_rte_smiles.asp","","font-family:Verdana; font-size:12; dialogWidth:30em; dialogHeight:34em" );
    	if (smiley_img) {
    		idContent.document.focus();
    		var sel = idContent.document.selection.createRange();
    		sel.pasteHTML(smiley_img);
    				}
    	}
    and here is the code i have on the pop up smiley page

    Code:
    <script language="Javascript">
    function insertsmilie(){
    	var img = window.event.srcElement
    	var src = img.src;
    			window.returnvalue= '<IMG border="0" align="absmiddle" src="' + src + '">';
    			window.close();
    }
    </script>
    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

    Regards,

    Spoon

  • #2
    New Coder
    Join Date
    Jul 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Its ok, i got it to work, just a small coding error.....


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •