[英]Javascript Groovy button doesn't work in IE
I've made buttons at the bottom of this page: http://www.constructionline.co.uk/static/acclaim/index.html 我已经在此页面底部创建了按钮: http : //www.constructionline.co.uk/static/acclaim/index.html
But they don't act as links in IE. 但是它们不充当IE中的链接。 I'm using IE 11. Can any one help?
我正在使用IE11。有人可以帮忙吗?
An <input>
with type=button won't work as you're expecing on it's own. 带有type = button的
<input>
不能正常工作,因为您自己需要它。 The only reason it works in other browsers is that it's wrapped in an <a>
. 它在其他浏览器中起作用的唯一原因是它包装在
<a>
。 This isn't correct HTML and I believe IE's behaviour is correct, whereas other browsers are being a bit more flexible. 这不是正确的HTML,我相信IE的行为是正确的,而其他浏览器则更加灵活。
What you could do, is remove the <a>
and add an onclick event to the <input>
, like: 您可以做的就是删除
<a>
并将onclick事件添加到<input>
,例如:
<input type="button" name="Benefits" class="groovybutton" value="Find out more benefits >>" onclick="location.href = 'acclaim/acclaimbenefits.html'" onmouseover="goLite(this.form.name,this.name)" onmouseout="goDim(this.form.name,this.name)" style="background-color: rgb(169, 34, 22); border-color: rgb(169, 34, 22);">
The problem then is that browsers without javascript support won't be able to follow the link. 然后的问题是,没有JavaScript支持的浏览器将无法访问该链接。
Really, I don't think you need the <input>
at all, you should be able to just do this: 确实,我认为您根本不需要
<input>
,您应该能够做到这一点:
<a href="acclaim/acclaimbenefits.html" class="ac-no-arrow">Find out more benefits >></a>
Your goLite() and goDim() javascript could probably be replaced with CSS 您的goLite()和goDim()javascript可能会替换为CSS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.