SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Edit iFrame Input Fields

    hi,
    i would like to edit form fields in iframe and also insert values in those input fields using javascript.. is there any way to do this?

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Presuming that the holding page and the iframe page are on the same server, yes, you can communicate between the two using JS, you should first search on the Javascript forum for your problem, then ask around on there if you cannot find anything.

    Ask a moderator to move this thread if you like.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. i've found one solution to get contents from iframe..
    It works fine while getting contents from local . but its not working for website because of permission problem


    <html>
    <head>
    <script type="text/javascript">
    function getContentFromIframe(iFrameName)
    {
    var myIFrame = document.getElementById(iFrameName);
    var content = myIFrame.contentWindow.document.body.innerHTML;
    alert('content: ' + content);
    }
    </script>
    </head>

    <body>
    <input type='button' onclick="getContentFromIframe('Iframe_links')" value='Click' name='sub' />
    <br />
    <iframe src="http://localhost/test/test.php" frameborder='0' width='100%' height='100%' scrolling='auto' style='display:block;border:0px;overflow:scroll;' id='Iframe_links' name='Iframe_links'> </iframe>
    </body>
    </html>

  4. #4
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Are the two documents on the same server, like Cups mentioned?

    If not, this won't work.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2009
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No both documents are in the different server.. thats the problem ... is there any other way to access from different server..

  6. #6
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Well, you could load the other page using PHP (file_get_contents() or similar), and then incorporate the returned results into your html/ javascript some way.


Bookmarks

Posting Permissions

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