Javascript Groovy按钮没有'我不在IE工作

Javascript Groovy button doesn't work in IE

本文关键字:IE 工作 按钮 Groovy Javascript      更新时间:2024-01-09

我在这个页面的底部制作了按钮:http://www.constructionline.co.uk/static/acclaim/index.html

但它们在IE中不起链接的作用。我使用的是IE 11。有人能帮忙吗?

具有type=按钮的<input>无法工作,因为您正在单独进行实验。它在其他浏览器中工作的唯一原因是它被封装在<a>中。这不是正确的HTML,我相信IE的行为是正确的,而其他浏览器则更加灵活。

您可以做的是删除<a>并向<input>添加onclick事件,如:

<input type="button" name="Benefits" class="groovybutton" value="Find out more benefits &gt;&gt;" 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);">

问题是,没有javascript支持的浏览器将无法访问该链接。

真的,我认为你根本不需要<input>,你应该可以这样做:

<a href="acclaim/acclaimbenefits.html" class="ac-no-arrow">Find out more benefits &gt;&gt;</a>

您的goLite()和goDim()javascript可能会被CSS 取代