Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

Learn More

window.print() does not work in firefox 12 version where as the same works in IE

  • 1 답장
  • 4 이 문제를 만남
  • 1 보기
  • 최종 답변자: cor-el

more options

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.

The following is the extract of page source of my application:<br /> <br /> <pre><nowiki><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> </nowiki></pre> 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.

글쓴이 cor-el 수정일시

선택된 해결법

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()'>
문맥에 따라 이 답변을 읽어주세요 👍 1

모든 댓글 (1)

more options

선택된 해결법

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()'>