Hi,Would really appreciate your thoughts on this. I'm trying to isolate an area of a long WordPress page to print. I've come across a script which actually does an excellent job in IE but not in FF. Firefox doesn't want to know for some reason. Is there anything you can see from the following that would be causing FF to have headaches? Script: function printURL(sHref) { if(document.getElementById && document.all && sHref){ if(!self.oPrintElm){ var aHeads = document.getElementsByTagName('HEAD'); if(!aHeads || !aHeads.length) return false; if(!self.oPrintElm) self.oPrintElm = document.createElement('LINK'); self.oPrintElm.rel = 'alternate'; self.oPrintElm.media = 'print'; aHeads[0].appendChild(self.oPrintElm); } self.oPrintElm.href = sHref; self.focus(); self.print(); return true; } else return false; } Body: <a onclick="printURL(this.href); return false;" href="#" target="_blank">print</a> Would appreciate your thoughts. Thanks.
your code will only work for IE.. why? because of this: if(document.getElementById && document.all && sHref) document.all is only readable by IE.. so running the script in firefox or other browsers will automatically answer the if with a false..