2012-01-11 79 views
1

我目前正在使用HTML5开展大学项目。 我一直在使用按钮标签编写我的所有代码。 我一直在使用chrome测试网站,但是,刚刚注意到,虽然按钮出现在IE和Firefox中,但它们不起作用。获取HTML5“按钮”标签以跨浏览器工作

有没有办法解决这个问题?或者按钮标签在这些浏览器中不起作用?

这是在chrome中运行得很好的代码,但不是其他浏览器。

<div class="option" id="question1" style="display:none"> 
<p> Which way do you think the criminals have fled?</p> 
<p>Up the Stairs <button class="arrow" id="stairs"><a href="upstairs.html"><img src="images/arrow.png" width="15" height="15"/></a></button></p> 
<p>Down the Alley <button class="arrow" id="alley"><a href="alley.html"><img src="images/arrow.png" width="15" height="15"/></a></button></p> 
</div> 
+0

应该通过IE和Firefox的支持,你能提供什么不工作代码片段?另外,什么版本的IE和Firefox? – Danny 2012-01-11 20:17:28

+1

按钮标记已经存在了很长一段时间,这是HTML5之前的标准。 – jValdron 2012-01-11 20:18:38

+0

过去人们对此有很多评论。退房http://stackoverflow.com/questions/469059/button-vs-input-type-button-which-to-use – 2012-01-11 20:22:45

回答

2

button元素不能有交互的后代。因此,您不能将a标记作为button元素的子标记。只需从button中删除a标签,并根据需要更改您的代码。请致电button Element in the HTML Specification

<div class="option" id="question1" style="display:none;"> 
<p>Which way do you think the criminals have fled?</p> 
<p>Up the Stairs <button class="arrow" id="stairs"><img src="images/arrow.png" width="15" height="15"></button></p> 
<p>Down the Alley <button class="arrow" id="alley"><img src="images/arrow.png" width="15" height="15"></button></p> 
</div>