CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2013
    Posts
    7

    Question How can I submit data into an iFrame?

    I am trying to automatically submit data into my iFrame. In the iFrame will be multiple text boxes and a submit button. I want to enter data into those text boxes and submit it.

    This code is not working for me...

    <html>
    <head>Sim Game</head>
    <body>

    <script type="text/javascript">
    function subForm() {
    document.myform.submit();
    }
    {
    myform.Arrive.value="Hello";
    myform.Leave.value="Goodbye";
    subForm();
    }
    </script>

    <form method="post" name="myform" target="myFrame">

    <iframe height="600" width="600" frameborder="0"

    src="MyWebPage.com" name="myFrame">

    </body>
    </html>

  2. #2
    Join Date
    Mar 2013
    Location
    Antwerp, Belgium
    Posts
    3

    Re: How can I submit data into an iFrame?

    this javascript, not Java

  3. #3
    Join Date
    Feb 2013
    Posts
    4

    Re: How can I submit data into an iFrame?

    Does this show the content to everybody, or only to you on the one session?

  4. #4
    Join Date
    Feb 2013
    Posts
    4

    Re: How can I submit data into an iFrame?

    If you are generating the iframe on the fly on IE8, there is one special gotcha for this particular browser. You need to specify the name attribute inside your document.createElement method call:


    var iframe;
    try {
    iframe = document.createElement('');
    } catch (ex) {
    iframe = document.createElement('iframe');
    iframe.name = 'the-iframe-name';
    }

    otherwise, form upload will simply replace the current page.

  5. #5
    Join Date
    May 2009
    Location
    Lincs, UK
    Posts
    298

    Re: How can I submit data into an iFrame?

    This is still Javascript, not Java. Please use the appropriate forum (scripting).

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured