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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to transfer insertAdjacentHTML content to iframe page in netscape using frames

    Dear friend,

    I have a page with a IFRAME in it. I want to pass some html content from the main page to the IFRAME page, so i used insertAdjacentHTML in IE and it worked fine. But it didnt work in Netscape.

    I searched the net and found out the alternative methods, but they are working fine if i want to transfer the html content within that page. How to transfer the html content to the Iframes page.



    some one please help me immediately.

    regards,
    kiran kumar.
    Last edited by mvkirankumar; 05-08-2003 at 07:50 AM.

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    insertAdjactentHTML is not a W3C method, but a Microsoft proprietary extension. I wouldn't recommend using it for anything that the W3C DOM can do.

    The problem you are having, is because an element created in one document isn't part of another document - you either have to create it in/from the document you want, or import it into the document. Creating it in the document is easiest: Use document.getElementById([string IdOfIFrame]).contentDocument instead of document. Only note that some browsers use .document instead of .contentDocument. You can also use the DOM0 way of referencing it through window.frames. The same difference between W3C and de facto standards exist here, too, but the de facto way works in all cases I've seen.

    The other way is to use document.importNode, and then append the nodes where you want them. Have a look at W3C [DOM1], [DOM2 Core] and [DOM2 HTML] specs, or have a look at the Gecko DOM Reference. (link list available from my sig.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Maybe write a DOM implementation of insertAdjacentInnerHTML function. I think I have it at home. I'll have to check in a few hours.
    What did you mean some HTML 'from' the main page? Arbitrary HTML string I suppose.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts


  •  

    Posting Permissions

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