speedmax (owner)

Revisions

  • 5eaa9f Tue Jul 07 21:04:18 -0700 2009
gist: 142570 Download_button fork
public
Public Clone URL: git://gist.github.com/142570.git
Embed All Files: show embed
iframe.html #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  <script type="text/javascript">
    var iframe = document.createElement('iframe');
    iframe.style.border = 0;
    iframe.style.backgroundColor = '#fff';
    iframe.style.width = '160px';
    iframe.style.height = '600px';
    
    var container = document.getElementById('oddsense') || document.body;
    
    container.appendChild(iframe);
    
    var doc = iframe.document;
    if (iframe.contentDocument) {
      doc = iframe.contentDocument;
    } else {
      doc = iframe.contentWindow.document;
    }
    
    var body = '<h1 class="test">hello world</h1>';
    var style = '.test {color:red;}';
    
    doc.open();
    doc.writeln('<head><title>Please click to find out more</title>'+
                '<style>'+style+'</style></head>'+
                '<body>'+ body+'</body>')
    doc.close();
  </script>