473,386 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

why is this code not working - printing a pop up

It makes all the sense in the world, but its not working. Any idea why?
Click the popup button to popup a new screen, and then click the print
button on the popup (which doesn't do anything!).

<html>

<head>
<title>UGH!</title>

<script type="text/javascript">

function createPrintPageHeader(x) {

x.document.write("<HTML>\n");
x.document.write("<HEAD>\n");
x.document.write("<TITLE>Report</TITLE>\n");
x.document.write("</HEAD>\n");
x.document.write("<BODY>\n");

}
function createPrintPageFooter(x) {

x.document.write("</BODY>\n");
x.document.write("</HTML>\n");

}

function doPrint() {

printWin=open('','printWindow','resizable=no,width =690,height=600,menuba
r=yes,status=yes,scrollbars=yes');
createPrintPageHeader(printWin);

printWin.document.write('foo');

printWin.document.write('<form>');
printWin.document.write('<input type=\"button\" value=\"Print contents
of popup\" onclick=\"self.print()\">');
printWin.document.write('</form>');

createPrintPageFooter(printWin);

}

</script>
</head>

<body>
<p>This is just a paragraph. </p>
<form>
<input type="button" value="PopUp" name="btnPopUp"
onclick="doPrint()"></p>
</form>
</body>
</html>
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
1 1496
> It makes all the sense in the world, but its not working. Any idea why?
Click the popup button to popup a new screen, and then click the print
button on the popup (which doesn't do anything!).

printWin.document.write('<form>');
printWin.document.write('<input type=\"button\" value=\"Print contents
of popup\" onclick=\"self.print()\">');
printWin.document.write('</form>');


You can better use window.print();

Also it would be more compatible if you use printWin.document.open();
before you write the HTML and printWin.document.close(); after all the
content is written.

The rest looks fine to me.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: TimS | last post by:
I am getting a baffling File not found error (0x800A0035). I am writing asp on a windows 2000 server. I build a path and filename from several fields in a jet database using SQL commands, like...
7
by: Jonathan Smith | last post by:
Hi In order to make it easier for my colleagues to write their school reports I thought I might attempt to write a (simple) program. At the moment I am working mentally through the steps I would...
5
by: Henry Jordon | last post by:
hello I was wondering if someone could help me get a main going on this project I've completed the header file that the professor started us on but not really sure how to get the main going. If...
4
by: John | last post by:
I have code that opens and prints a report using the Adobe PDF printer driver. The problem is that Access VB executes the next step in code before the PDF "Printer" is done "printing". Since the...
0
by: Jason Xu | last post by:
Hello, I am working on printing richtext with C# by sending EM_FORMATRANGE message to the underlying richedit control. I can set the text format by sending EM_SETPARAFORMAT message now. However,...
21
by: BWIGLEY | last post by:
Basically I've just started making a game. So far it makes an array 25 by 20 and tries to make five rooms within it. In scr_make_room() there's parse errors: 20 C:\c\Rooms\Untitled1.c parse error...
7
by: anushhprabu | last post by:
#define q(k)main(){ return!puts(#k"\nPRABUq("#k")");} q(#define q(k)main(){return!puts(#k"\nq("#k")");}) guys i'm working on this code.. i got it fromnet.. how this is working.. anyone pls.....
0
by: nikhilgargi | last post by:
Requirement: I need to provide printing capability in a C# desktop application that I am developing The documents that need to be printed can be in Rich Text Format (RTF) or HTML. Custom...
2
by: JimmyKoolPantz | last post by:
We purchased som software for encoding a barcode. We want to automate the process of converting a number to a readable barcode. However, I am having a few issues. The file that the barcode...
2
by: necron99 | last post by:
import RuntimeEnvironment as renv import os, sys import win32com.client import getpass OMI = win32com.client.Dispatch("MOVEitAPI.clientObj") OMI.Host = system
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.