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
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Posting text from child windo to opener window

    Hi There,

    I am a newbie in this javascript world and also in this forum. I have run into a very strange problem.

    I have a page which opens a new popup window and on that window, after clicking on a link, the content of a textbox must go to the parent (opener) window's textbox. I have used the following code and it works fine in my localhost. But, after I upload it to my server, and run from then, IE shows a "Access is denied" error message...........can any1 help me resolve this issue ??

    Here is the main page code:

    <script LANGUAGE="JavaScript">
    <!--
    var newwindow = '';

    function popitup(url)
    {
    if (!newwindow.closed && newwindow.location)
    {
    newwindow.location.href = url;
    }
    else
    {
    newwindow=window.open(url,'name','height=460,width=600');
    if (!newwindow.opener) newwindow.opener = self;
    }
    if (window.focus) {newwindow.focus()}
    return false;
    }

    function setHTML(val ) {
    var f = document.oArticleForm;
    if (val != '') {
    f.campaign_article_text.value = val;
    }
    }

    // End -->
    </script>

    Fill out the following information as needed:
    <form method="POST" name="oArticleForm" action="/myCampaignManager/index.php">
    <table>
    <tr>
    <td align="right"><textarea NAME="campaign_article_text" rows="10" cols="70"></textarea>
    <br>
    <a href="#" onclick="popitup('http://www.itestweb.com/spaw/edit.php')">Edit in WYSIWYG Editor </a></td>
    </tr>

    ..............

    And the child window (edit.php), has the following code:

    <script LANGUAGE="JavaScript">
    <!--
    function refreshForm() {
    var newHTML = document.forms.HTML.spawHTML.value;
    window.opener.setHTML(newHTML);
    return false;
    }
    // End -->
    </script>

    <form name="HTML" action="#" method="post" onSubmit="return refreshForm();">

    .............

    <input type="submit" name="Submit" value=" Save ">
    </form>

    ...........

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Are the two pages in the same domain? For security reasons, a site cannot access any content from external sites and vice versa.

  • #3
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    Are the two pages in the same domain? For security reasons, a site cannot access any content from external sites and vice versa.
    Yes, both of them are in the same domain and in the same directory. However, I have discovered some more ridiculous fact. If I put both of them in a normal file, they work just fine. But, they wont work from my script. If you want to have a look at the main script, let me know. It will be of great help.

    Thanks for your reply.


  •  

    Posting Permissions

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