javascript - removeChild() deletes subelements? -


i got challenge trying better understand how things work in world. there 2 html pages:

one.html

<html> <script>     var ifrm = document.createelement("iframe");     var c = document.head;     ifrm.src = 'two.html';     (c = document.head || document.body) && c.appendchild(ifrm);     //ifrm.parentnode && ifrm.parentnode.removechild(ifrm) </script> </html> 

two.html

<html> <script>     var newl = parent.document.createelement("img");     newl.src = 'http://qwerty.com';     parent.document.body.appendchild(newl); </script> </html> 

i can control contents of two.html , i'm trying create in parent, persist after uncommenting last line in js one.html. of now, tag created once uncomment line removechild(), it's gone. can 1 explain me why, , if there way complete task under specified circumstances? in advance!


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -