繁体   English   中英

我下面有一个代码-在IE和Opera中效果很好,但在Firefox / Netscape中根本不起作用。 有任何想法吗?

[英]I have a code below - works great in IE and Opera, but does not work at all in Firefox / Netscape. Any ideas?

我必须在下面进行编码-在IE和Opera中效果很好,但在Firefox / Netscape中根本不起作用。 有任何想法吗?

问题是单击友好的打印机时什么也没有发生。

<html>
<head>
  <script type="text/javascript">
    function onPrint()
    {
    window.printForm.submit();
    }
  </script>
</head>
<body>
  <form name="printForm" action="/xasp?print=on" method="post">
    <table>
      <tr>
        <td><input type="checkbox" name="show" onClick="formSubmit();"></td>
      </tr>
    </table>
  </form>
</body>
</html>

您必须通过ID而不是名称来获取表单。

document.getElementById("printForm").submit();
document.forms["printForm"].submit();
<form name="printForm" ction="/xasp?print=on" method=post>

“部分”,那是什么? ;)这是张贴错误,还是您在代码中拼错了动作?

我认为您需要以下内容:

document.getElementById("printForm").submit();

直接从window对象引用表单不是标准的,当然也不是所有浏览器都支持。

我认为您应该使用document.printForm而不是window.printForm。 并在表单标签中输入“操作”而不是“部分”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM