Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,008
    Thanks
    59
    Thanked 10 Times in 10 Posts

    Question window.print() not working in IE7

    The following code outputs a button that prints fine in firefox but not in IE7
    Code:
       function printPage(htmlPage)
        {
            var w = window.open("about:blank");
            w.document.write(htmlPage);
             w.document.write("<br><form><input type='button' value=' Print this page 'onclick='window.print(); ;return false' /></form>");
          //  w.print();
       //     w.close();
        }
    any ideas friends


  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Maybe you should use the quotes in standard way. And leave spaces between attributes. And you have 2 semicolons. In fact you need no one, as the return false is useless.Try this:
    Code:
    w.document.write('<br><form><input type="button" value=" Print this page " onclick="window.print()" /></form>');
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,008
    Thanks
    59
    Thanked 10 Times in 10 Posts
    thanks but no luck with that

    Code:
    <script language="JavaScript">
        function printPage(htmlPage)
        {
            var w = window.open("about:blank");
            w.document.write(htmlPage);
        
             w.document.write('<br><form><input type="button" value=" Print this page " onclick="window.print()" /></form>');
          //  w.print();
       //     w.close();
        }
    </script>



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •