Hi guys,
Would really appreciate your help with something. 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:
[CODE]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:
[CODE]<a onclick=”printURL(this.href); return false;” href=”#” target=”_blank”>print</a>
With that above I can target right down to even printing, in isolation, just an image, so it’s a real winner as I have coupons on the page that I want printed in isolation, but Firefox just plays dumb when I hit the ‘print’ button. Would really appreciate your thoughts.