href 围绕输入类型提交 [英] href around input type submit

查看:26
本文介绍了href 围绕输入类型提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么围绕输入类型提交的 href 不在 IE 中工作?(以及我能做些什么来修复它)

why isn't a href around an input type submit not working in IE? (and what can I do to fix it)

<!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>

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;
}

这在 Firefox 中运行良好...

This works fine in firefox ...

推荐答案

为什么要将提交按钮放在锚点中?您正在尝试提交表单或转到其他页面.哪一个?

Why would you want to put a submit button inside an anchor? You are either trying to submit a form or go to a different page. Which one is it?

要么提交表单:

<input type="submit" class="button_active" value="1" />

或转到另一个页面:

<input type="button" class="button_active" onclick="location.href='1.html';" />

这篇关于href 围绕输入类型提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆