【问题标题】:Input type image does not work in Internet Explorer, though works in Chrome and Firefox输入类型图像在 Internet Explorer 中不起作用,但在 Chrome 和 Firefox 中有效
【发布时间】:2012-08-02 00:52:30
【问题描述】:

我无法弄清楚为什么以下输入在 IE 中不起作用。我也尝试了type="button",但它也不起作用。

<input type="image" src="/images/150x200.png" alt="Profile" onClick="window.open('http://www.genericname.com/blah.aspx','Blah - Blah Blah','width=790,height=600,resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no')" />

我的目标是在单击按钮时以 弹出窗口 的形式打开一个新的窗口

我需要知道这是否是一个已知错误。如果是这样,我将需要找到其他解决方案。欢迎提出任何建议。

【问题讨论】:

    标签: javascript image internet-explorer input onclick


    【解决方案1】:

    您应该在 IE 中收到一个错误 Invalid Argument,这就是它无法打开的原因,因为 Window,open() 不喜欢传递给 window,open() 的空格字符。如果你摆脱了等等等等之间的空格,它就会起作用。

    【讨论】:

      【解决方案2】:

      问题是您使用的窗口名称“Blah - Blah Blah”会让 IE 不满意。它应该看起来像一个标识符(没有空格,我认为也没有“-”)。

      【讨论】:

      • 感谢您的快速回复!我不敢相信我错过了。
      猜你喜欢
      • 2020-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多