This line is a KILLER:
var newstr = document.all.item(printpage).innerHTML;
document.all DOES NOT EXIST on any platforms except MSIE 8 and below. So on other platforms, that line will cause an error when the .item property is attempted.
At which time the entire function fails. *KABLOOEY*
document.all has *NOT* been needed since the days of MSIE 4. 1997 or so. Are you really wanting to be compatible with a browser nobody has used in 10 years?
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.