B
bs9999
Can someone please tell me why when i use <object>.clondeNode that when
I appendChild it to my document, the new node doesnt properly work? I'm
making a clone of a <script> and <link> node from an iframe on my page.
The cloned node looks fine, and even appends to my document fine.
Viewing innerHTML confirms it is appart of my document. The problem is
when i do something like alert(myTestVar), where myTestVar was
originally a javascript variable declared within the iframe <script>
tag (the iframe cloned node), i get back an undefined error. The only
way this will work is if i do a document.createElement and manually
copy the innerHTML, and attributes of the original node, then
appendChild -- now Javascript will present the proper value for the
variable.
Can someone explain to me whats happening? Maybe despite the node being
cloned, it is still apart of some other "document" (the iframe) and so
cant be appended to the new, different document? Is there a way around
such a thing?
I appendChild it to my document, the new node doesnt properly work? I'm
making a clone of a <script> and <link> node from an iframe on my page.
The cloned node looks fine, and even appends to my document fine.
Viewing innerHTML confirms it is appart of my document. The problem is
when i do something like alert(myTestVar), where myTestVar was
originally a javascript variable declared within the iframe <script>
tag (the iframe cloned node), i get back an undefined error. The only
way this will work is if i do a document.createElement and manually
copy the innerHTML, and attributes of the original node, then
appendChild -- now Javascript will present the proper value for the
variable.
Can someone explain to me whats happening? Maybe despite the node being
cloned, it is still apart of some other "document" (the iframe) and so
cant be appended to the new, different document? Is there a way around
such a thing?