views:

131

answers:

1

I am trying to print a portion of the page in FF3. This works fine in IE7. In FF, the page correctly changes to the part I am trying to print, but the Print Dialog never appears. Here is my code:

function PrintPage() {
    var fullPage = document.body.innerHTML;
    document.body.innerHTML = document.getElementById('content').innerHTML;
    document.focus();
    window.print();
    document.body.innerHTML= fullPage; 
}

What am I doing wrong here ?

+1  A: 

document.focus doesn't exist in FF. I suppose your code blows up with a TypeError when calling document.focus, right before window.print. Does print dialog appear if you remove conflicting statement?

kangax