输入按钮类型="image"在ie11中不能使用href

Input Button of type="image" is not working with href in IE 11

本文关键字:quot 不能 href image 按钮类型 输入 ie11      更新时间:2023-09-26
<a href="javascript:OpenRuleEditor('@Url.Action("AddRule", "AdvancedRuleSearch", new { mode = "add" })','AddNewRule','Add New Rule')" style="text-decoration: none; display:inline-block">                          
    <input name="Plus" type="image" src="~/GHAimages/129.png" id="btnAddRule" title="Add New Rule"/>
</a>
点击这个按钮将打开一个新的页面。按钮基本上是一个图像按钮(图标,帮助用户了解他们正在做什么)。在Firefox和Chrome中运行良好。但在IE 11中,它不起作用。当我将其类型从type="image"更改为type="button"时,它开始工作,但不显示图像。

也试过下面的代码,把它放在标签里面。

onclick="window.location=this.parentNode.href;

现在,图像显示在按钮上,按钮也在工作,页面也在打开,但在它被调用的窗口的背面。

欢迎任何帮助

您可以使用<img>标记代替输入标记。

<a href="javascript:OpenRuleEditor('@Url.Action("AddRule", "AdvancedRuleSearch", new { mode = "add" })','AddNewRule','Add New Rule')" style="text-decoration: none; display:inline-block">
    <img src="~/GHAimages/129.png"></img>
</a>

另外,我不认为你需要一个波浪在你的路径,试着用src="/GHAimages/129.png"代替src="~/GHAimages/129.png"。我会在使用图像标签之前尝试这个

没有正当理由在input[type="image"]周围包装<a href>标记。

你是否考虑过只使用<img> ?