PDA

View Full Version : Problems with Print Script


Code_gate
02-12-2003, 07:10 PM
I have been trying to get the following function to work as I want it to and am not having much success. The idea is that when a user clicks on a certain button, whatever is displayed in the iframe (named "bwindow") will print. However, the problem I am having is that it is printing the entire document, not just the contents of the iframe as desired.

Anyone know what I am doing wrong?

Here's the function:

function varitext(text){
text=window.bwindow.location
print(text)
}

Roy Sinclair
02-12-2003, 08:54 PM
Try this:


function varitext(){
document.getElementById('bwindow').print();
}

Quiet Storm
02-12-2003, 09:21 PM
I think you'll have to set focus() to the iframe first:

window.frames['bwindow'].focus();window.frames['bwindow'].print();