ScottInTexas
12-09-2002, 07:52 PM
I have put a button in an IFrame in my document. The onClick method calls the doPrint function.
function SetPrintButton(){
var objFrame=self.frames['printFrame'];
var printButton='<input type="button" value="Print Table" onClick="parent.doPrint()">';
with (objFrame){
document.write(printButton);
}
}
function doPrint(){
alert("I am in do print " );
print(self.frames['dataWindow'].text);
}
or
function doPrint(){
alert("I am in do print " );
print(parent.frames['dataWindow'].document);
}
If I leave out the 'self' or 'parent' nothing hapens at all. Isn't the parent also the self in this case?
The button is written correctly and calls the doPrint function but prints the contents of itself, in other words a nice button is printed on the paper. The name of the frame which is occupied by a large table is dataWindow.
I have tried passing the dataWindow.document to the print function and I have tried accessing the document using the parent.frames['dataWindow'].document. I had read somewhere that text was a member of the document object, but now I can't find that reference.
This print does call up the print dialog, so I just need it to point to the right document.
Any ideas?
function SetPrintButton(){
var objFrame=self.frames['printFrame'];
var printButton='<input type="button" value="Print Table" onClick="parent.doPrint()">';
with (objFrame){
document.write(printButton);
}
}
function doPrint(){
alert("I am in do print " );
print(self.frames['dataWindow'].text);
}
or
function doPrint(){
alert("I am in do print " );
print(parent.frames['dataWindow'].document);
}
If I leave out the 'self' or 'parent' nothing hapens at all. Isn't the parent also the self in this case?
The button is written correctly and calls the doPrint function but prints the contents of itself, in other words a nice button is printed on the paper. The name of the frame which is occupied by a large table is dataWindow.
I have tried passing the dataWindow.document to the print function and I have tried accessing the document using the parent.frames['dataWindow'].document. I had read somewhere that text was a member of the document object, but now I can't find that reference.
This print does call up the print dialog, so I just need it to point to the right document.
Any ideas?