Parent page Code
Copy code The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
</Head>
<Body>
<Div style = "height: 300px; Background-color: # cc9900"> </div>
<Div>
<IFRAME src = "test_iframe.html"> </iframe>
</Div>
</Body>
</Html>
IFRAME Page codeCopy codeThe Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> untitled document </title>
<SCRIPT src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"> </SCRIPT>
<SCRIPT>
$ ("Body", parent.doc ument). append ('hahahaha ');
</SCRIPT>
</Head>
<Body>
IFRAME test -- @ mybest
</Body>
</Html>
There is such a record in the jquery document:
Jquery (HTML, [ownerdocument])
Parameters
HTML string
HTML Tag string used to dynamically create DOM elements
Ownerdocument (optional) Document
Document where the DOM element is created
I still want to read more and read more documents. what is it really like: I read a book a hundred times!
------ Note --------------------------
During the test, I found that Chrome could not meet the above requirements. Later I saw that IFRAME cannot be cross-origin, which is one of the problems. Another reason is to put it in a site for testing.
For example, http: // localhost: 8087/test.html
In this way, chrome will be normal.