开发者

Simple Button problem In IE

开发者 https://www.devze.com 2023-03-27 15:50 出处:网络
I also discovered the button works with Firefox开发者_如何学JAVA but not IE. Do you know why? <td><a href=\"crt.php\"><button>Create New Listing</button></a></td>

I also discovered the button works with Firefox开发者_如何学JAVA but not IE. Do you know why?

<td><a href="crt.php"><button>Create New Listing</button></a></td>


<td><button type="button" onclick="location.replace('/crt.php')">Create New Listing</button></td>

I think this is more of what you're after. I don't know if you can even use a button like you're trying to.


Ignoring the reality of what actually works in browsers, according to the HTML5 spec you can't have a button inside an a.

http://developers.whatwg.org/text-level-semantics.html#the-a-element

The a element
Content model: Transparent, but there must be no interactive content descendant.

http://developers.whatwg.org/content-models.html#interactive-content

Interactive content is content that is specifically intended for user interaction.

  • a
  • button
  • ...


I'm guessing you want a submit button? That's actually an INPUT tag. The FORM tag will make it go to the page you want.

<form action="crt.php" method="get">
<input type="submit" value="Create New Listing" />
</form>

You could also use JavaScript.


http://www.w3schools.com/tags/tag_button.asp

Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".


<td>
    <form action="crt.php">
        <input type="submit" value="Create New Listing">
    </form>
</td>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号