469,649 Members | 1,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

Create HTML page without active script warning message by Javascript on IE browser

Hi All,

I have the below code which worked as what I want on Firefox, but the code did not work on IE6. Do you guys have any suggestion for me how to fix the code below to make it work on IE? Thank you for any help in advance.

Expand|Select|Wrap|Line Numbers
  1. <!-- saved from url=(0014)about:internet -->
  2. <html>
  3. <head><title>Test</title>
  4. <script type="text/javascript">
  5. <!--
  6. function printPage(){
  7. var content;
  8. content = document.body.innerHTML;
  9. content = '<h1>Test</h1>';
  10. display(content);
  11. }
  12.  
  13. function display(content) {
  14.  top.consoleRef=window.open('','myconsole','width=800,height=500,status=0,scrollbars=1,resizable=1,menubar=1,toolbar=1')
  15.  top.consoleRef.document.writeln('\<!-- saved from url=(0014)about:internet --\>');
  16.  top.consoleRef.document.writeln('<html><head><title>My Document</title>'
  17.     + '<STYLE TYPE="text/css">'
  18.     + '    H1 ' 
  19.     + '            {'
  20.     + '            font-family: Arial, Helvetica, sans-serif;'
  21.     + '            font-size: 16px;'
  22.     + '            font-style: normal;'
  23.     + '            font-weight: bolder;'
  24.     + '            font-variant: normal;'
  25.     + '            color: White;'
  26.     + '            text-align: center;'
  27.     + '            text-transform: capitalize;'
  28.     + '            height: 20px;'
  29.     + '            background-color : #638eb9;'
  30.     + '            }'    
  31.     + ' </STYLE> '
  32.     + ' </head>'
  33.     + ' <body bgcolor=white onLoad="self.focus();window.print()">'
  34.     + content
  35.     + '</body></html>'
  36.  )
  37.  top.consoleRef.document.close()
  38. }
  39. -->
  40. </script>
  41. </head>
  42. <body>
  43. <a NAME="PRINT" HREF="javascript:printPage()"><font size="2">Click For Printable Document</font></a>
  44. </body>
  45. </html>
  46.  
Jun 14 '08 #1
1 1679
acoder
16,027 Expert Mod 8TB
What part doesn't work in IE6? Is it just the printing part?
Jun 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

42 posts views Thread by Santander | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.