Reputation: 1579
I'm not that familiar with the JS functions that are not applicable for firefox, thus i i'm posting here to ask you guys on what is wrong with my code. works on any other browsers except firefox.
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item("printable").innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
I did some reading and all i got was that document.focus is not applicable for firefox, but i'm not using that line of code so i'm a bit lost as to what is causing my problem. thank you all.
what happens is it does nothing at all, tried to do an alert just in case and it worked fine (commented all that code of course and only left the alert).
Upvotes: 1
Views: 2315
Reputation: 349252
Firefox does not print anything, because an early error is thrown. document.all
is undefined
in Firefox. Upon opening the console, the following error message should become visible near var newstr = ...
:
TypeError: document.all is undefined
Upvotes: 2