views:

33

answers:

0

Hi guys. I am trying to print the contents in the iframe in ie8 but it's not working. with ff however it does. :c

Here is the JS code:

$("#print_multi").click(function(){
    printpdf();
});

function isIE(){
    if(navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER'){return true;}
    else{return false;}
}
function printpdf(){
    if (isIE() == true){
        document.iframe_parent.focus();
        document.iframe_parent.print();
    }
    else{
        window.frames["iframe_parent"].focus();
        window.frames["iframe_parent"].print();
    }
}

AND HERE IS THE HTML:

<div style='display:none'>
    <!-- prints popup lightbox-->
    <div id='print_all_lb'>
        <div id="lightbox" align="left" style="width: 940px; height: 600px; overflow-y: auto;">
            <div class="close"><a href="#" class="close_win">Close Window</a></div>
            <div id="print_button"><input type="button" id="print_multi" name="print_multi" value="Print All" /></div>
            <iframe name="iframe_parent" id="iframe_parent" style="border:0; text-align:center; width:100%; height:100%; vertical-align:top;">   
                <html><head><title></title></head><body></body></html>
            </iframe>
        </div>
    </div>
</div>

I just couldn't figure the problem out. I googled for days and found several possible solutions but just don't apply to this. I hope you can help me guys....