Wrox Programmer Forums
|
BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5
This is the forum to discuss the Wrox book Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter Kit by David Sussman, Alex Homer; ISBN: 9780764588075
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 1st, 2006, 03:20 AM
Authorized User
 
Join Date: Mar 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Print html page using window.open

Hi,
 I am using window.open() method for client side printing of html pages. I am able to print one html page at a time but not more than one page. Please look at the below java script code snippet:

function combp1() {
                var x = new Array(3)
                x[0] = "hi how are you <a href='http://google.com'>google</a> "
                x[1] = "whats up "
                x[2] = "be happy and google (: <img src ='http://www.google.com/images/logo.gif'>"
                var asdf = "<html><body onload='javascript: window.print();'>"
                for (var i = 0; i < x.length; i++) {

                asdf = asdf + x[i]

                }
                asdf = asdf + "</body></html>"
                document.write(asdf)
                document.close()
                }

                function combp2() {
                var x1 = new Array(3)
                x1[0] = "hi manish "
                x1[1] = "whats up "

                var asdf1 = "<html><body onload='javascript: window.print();'>"
                for (var i = 0; i < x1.length; i++) {

                asdf1 = asdf1 + x1[i]

                }
                asdf1 = asdf1 + "</body></html>"
                document.write(asdf1)
                document.close()
                }

                function printall()
                {
                  combp1()
                  combp2()
                }
        </script>

Here two methods combp1 and combp2 having two different contents and printall() method call both of the method simultaneoulsy.
OK, Now the time to call printall()
<input type ="button" value ="print all" onclick ="printall()"/>
But only one method combp1() is calling and able to print only its contents.
How would I print the multiple pages.

Pleas guide me.

Thanks,
Manish







Similar Threads
Thread Thread Starter Forum Replies Last Post
i need to open powerpoint in the html page Fatma General .NET 0 April 5th, 2006 04:13 PM
Open Window and Write HTML to Child Advice fs22 Javascript How-To 3 August 6th, 2005 02:04 PM
Urgent: How to print an html page using C# mrameshchandra General .NET 2 January 5th, 2005 05:05 AM
Open Notepad from within an HTML page? larry Javascript How-To 2 April 26th, 2004 10:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.