Skip to content

Instantly share code, notes, and snippets.

@speedmax
Created July 8, 2009 04:04
Show Gist options
  • Save speedmax/142570 to your computer and use it in GitHub Desktop.
Save speedmax/142570 to your computer and use it in GitHub Desktop.
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment