1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
3 | <head> |
---|
4 | <title>Test</title> |
---|
5 | <style type="text/css"> |
---|
6 | div#hider { display : none; } |
---|
7 | </style> |
---|
8 | <script type="text/javascript" src="jquery.js"></script> |
---|
9 | <script type="text/javascript"> |
---|
10 | $(function () { |
---|
11 | var iframe = document.createElement("iframe"); |
---|
12 | iframe.src = "index-blank.html"; |
---|
13 | iframe.width = "100%"; |
---|
14 | iframe.height = "125"; |
---|
15 | iframe.style.border = "none"; |
---|
16 | $("div[id='source']").append(iframe); |
---|
17 | |
---|
18 | $(window).load(function () { |
---|
19 | var doc = iframe.contentDocument || iframe.contentWindow.document; |
---|
20 | var source = "<html>" + |
---|
21 | " <head>" + |
---|
22 | " <script src='jquery.js'></sc" + "ript>" + |
---|
23 | " <script>" + |
---|
24 | " $(function () {" + |
---|
25 | " $('p').show('slow');" + |
---|
26 | " });" + |
---|
27 | " </sc" + "ript>" + |
---|
28 | " </head>" + |
---|
29 | " <body>" + |
---|
30 | " <p style='display:none;'>hiya</p>" + |
---|
31 | " </body>" + |
---|
32 | "</html>"; |
---|
33 | doc.open(); |
---|
34 | doc.write( source ); |
---|
35 | doc.close(); |
---|
36 | }); |
---|
37 | |
---|
38 | $("button").click(function () { |
---|
39 | $("div#hider").show(); |
---|
40 | }); |
---|
41 | }); |
---|
42 | </script> |
---|
43 | </head> |
---|
44 | <body> |
---|
45 | <button>Show</button> |
---|
46 | <div id="hider"> |
---|
47 | <div id="source"></div> |
---|
48 | </div> |
---|
49 | </body> |
---|
50 | </html> |
---|