<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"
。在使用图像标签之前我会尝试这个。
关于javascript - 类型 ="image"的输入按钮在 IE 11 中无法与 href 配合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23951134/