www.webdeveloper.com
Results 1 to 4 of 4

Thread: getElementsByName problem

  1. #1
    Join Date
    Nov 2009
    Posts
    2

    getElementsByName problem

    Hi there,

    I want to fill in a whole form just by pressing on 1 button.
    The code i used (local) for this is:

    <script language="javascript">
    <!--
    function text()
    {
    parent.frames['iFrame'].document.getElementsByName('FormField')[0].value = "Text to put in formfield";
    return true;
    }
    </script>

    <input type="button" value="Do It" onclick="text();">

    <iframe name="iFrame" id="DS156" src="http://www.otherdomain.com" width="500" height="500" frameborder="1">

    ==============================================

    Thing is, the content i want to post, must go to a different domainname.
    When i test the html file (with above code) locally, it puts all the information into the form (on the other website) succesfull.
    When i upload the html (with above code) to my webserver and test it in (for example) InternetExplorer, it says "Access Denied" and refers to the line parent.frames.... etc.

    Any idea how to solve this?

    Thanks!

    Eric

  2. #2
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    make sure both pages are on the same domain if you want to use javascript.

  3. #3
    Join Date
    Nov 2009
    Posts
    2
    Thanks, but thats the problem.

    I want information from 1 page filled in into another page on a different domain.
    It's not possible to place both websites on the same domain...

    I found this article, but didn't quite understand if this would help me...
    http://groups.google.com/group/csexw...lnk=raot&pli=1

    Thanks for the help

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by ericcoumans View Post
    Thanks, but thats the problem.

    I want information from 1 page filled in into another page on a different domain.
    It's not possible to place both websites on the same domain...

    I found this article, but didn't quite understand if this would help me...
    http://groups.google.com/group/csexw...lnk=raot&pli=1

    Thanks for the help
    That article is about C#, I presume, that means a server-side language, not Javascript language.

    Javascript is a client-side language, thus it can not write/store data nor establish a cross-domain relationship. But you may do that on using AJAX+a server-side aplication+a database.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles