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
    Oct 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Possible for a script in IFRAME to access and write text on the page containing it ?

    Sirs,

    Is it possible for a script contained in a HTML page in an IFRAME tag, to write dynamic data to the page containing the IFRAME tag ?

    Example of the main page:
    <html>
    <head>
    </head>
    <body>
    <iframe name=dodata src="foo.html" frameBorder=0
    width=50 scrolling=false height=20 scrolling=no allowTransparency></iframe>
    <p id=rewrite> This data should be rewritten <p>
    </body>
    </html>

    example of the IFRAME page:
    <html>
    <head>
    </head>
    <body>
    <script>
    javascript statements to access the "rewrite" object in the main page, and write "hello world" or something similar
    </script>
    <p> Processing test, stand by
    </body>
    </html>

    Or is the page loaded in the iframe tag only able to access objects in it self ?

    Thanks in advance

    Johds

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can refer to an IFRAMES Parent by referencing
    parent.document as opposed to self.document

    Here's a Tute you may find helpful.

    ...Willy

  • #3
    New Coder
    Join Date
    Oct 2003
    Location
    19° 26' N, 99° 7' W
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have done something similar for a shopping cart. In that case I used text fields (borderless) in order to change some labels according to changes made on the iframe...for example:

    window.parent.document.frmNota.txtScan.value = document.frmShopCart.txtDescrition.value


  •  

    Posting Permissions

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