输入类型提交的href

Mar*_*arc 8 html css forms button

为什么不是一个输入类型的href提交不在IE中工作?(我该怎么做才能解决它)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen">
</head>
<body>
<a href="1.html"><input type="submit" class="button_active" value="1"></a>
<a href="2.html"><input type="submit" class="button" value="2"></a>
<a href="3.html"><input type="submit" class="button" value="3"></a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

style.css中:

* {
    margin: 0;
    padding: 0;
}

/* CSS Buttons: http://www.web4site.de/css/css-buttons.php */
.button {
    padding:0;
    margin:0;
    border:none;
    font-size:14px;
    background: url(../img/button.gif) no-repeat center;
    color: #000000;
    height:27px;
    width:134px; 
    font-variant:small-caps;
}

.button:hover {
    padding:0;
    margin:0;
    border:none;
    font-size:14px;
    background: url(../img/button.gif) no-repeat center;
    color: #FF0000;
    height:27px;
    width:134px; 
    text-decoration:none;
    font-variant:small-caps;
}

.button_active {
    padding:0;
    margin:0;
    border:none;
    font-size:14px;
    background: url(../img/button.gif) no-repeat center;
    color: #FF0000;
    height:27px;
    width:134px; 
    font-variant:small-caps;
}
Run Code Online (Sandbox Code Playgroud)

这在firefox中运行良好...

Kon*_*Kon 16

为什么要在提示符中放置提交按钮?您要么尝试提交表单,要么转到其他页面.哪一个?

提交表格:

<input type="submit" class="button_active" value="1" />
Run Code Online (Sandbox Code Playgroud)

或者转到另一页:

<input type="button" class="button_active" onclick="location.href='1.html';" />
Run Code Online (Sandbox Code Playgroud)


Que*_*tin 11

它不起作用,因为它没有意义(HTML 5明确禁止它的意义不大).

要修复它,请确定您是否需要链接或提交按钮并使用您真正想要的任何一个(提示:您没有表单,因此提交按钮是无意义的).

  • 那是你的问题.提交按钮是用于提交表单的东西,它不是想要使某些东西看起来像按钮.如果你想让它看起来像一个按钮**使用CSS**. (2认同)
  • 格式化**锚**,摆脱按钮. (2认同)