window.print() does not work in firefox 12 version where as the same works in IE
The following is the extract of page source of my application:
<script language='javascript'> function fncPrint() { document.getElementById("btnPrint").style.visibility="hidden"; document.getElementById("btnClose").style.visibility="hidden"; window.print(); document.getElementById("btnPrint").style.visibility="visible"; document.getElementById("btnClose").style.visibility="visible"; } </script> <td align='center' colspan='10'> <input type='button' class='button' value='Print' name='btnPrint' onclick='fncPrint()'> <input type='button' class='button' value='Close' name='btnClose' onclick='window.close()'> </td>
This code works fine IE but when used with firefox does nothing, it does not go for printing. I can use Control+P but it will not dim print and close buttons.
Moambuepyre
Ñemoĩporã poravopyre
You use document.getElementById("btnPrint"), but you only specify the NAME attribute in the input tags and not the ID.
So you will have to add the ID as well to make Firefox find that element.
<input type='button' class='button' value='Print' id='btnPrint' name='btnPrint' onclick='fncPrint()'> <input type='button' class='button' value='Close' id='btnClose' name='btnClose' onclick='window.close()'>Emoñe’ẽ ko mbohavái ejeregua reheve 👍 1
Opaite Mbohovái (1)
Ñemoĩporã poravopyre
You use document.getElementById("btnPrint"), but you only specify the NAME attribute in the input tags and not the ID.
So you will have to add the ID as well to make Firefox find that element.
<input type='button' class='button' value='Print' id='btnPrint' name='btnPrint' onclick='fncPrint()'> <input type='button' class='button' value='Close' id='btnClose' name='btnClose' onclick='window.close()'>