我的按钮内的文字可以在HTML中编辑.为什么?

Osi*_*s93 0 html javascript css cordova

我创建了一个基本的HTML页面,其中有一个Login和Cancel按钮,但每当我点击按钮时,它允许我编辑按钮本身的文本.我检查了编码,看起来非常好.经过研究,我只得到有关如何编辑字段等文本的结果.我该如何解决这个问题?

这是我用来创建按钮的HTML编码:

<input class="button" onclick="check(this.form)" value="Login"><br /><br />
    <input class="button" name="cancel"  value="Cancel">
Run Code Online (Sandbox Code Playgroud)

这是我在按钮的CSS中使用的类:

.button {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    padding: 14px 62px;
    border: 0px solid #2b27a1;
    border-radius: 35px;
    background: #2525f5;
    background: -webkit-gradient(linear, left top, left bottom, from(#2525f5), to(#000326));
    background: -moz-linear-gradient(top, #2525f5, #000326);
    background: linear-gradient(to bottom, #2525f5, #000326);
    text-shadow: #591717 1px 1px 1px;
    font: normal normal bold 20px verdana;
    color: #ffffff;
    text-decoration: none;

}
.button:hover,
.button:focus {
    border: 0px solid #453eff;
    background: #2c2cff;
    background: -webkit-gradient(linear, left top, left bottom, from(#2c2cff), to(#00042e));
    background: -moz-linear-gradient(top, #2c2cff, #00042e);
    background: linear-gradient(to bottom, #2c2cff, #00042e);
    color: #ffffff;
    text-decoration: none;
}
.button:active {
    background: #161693;
    background: -webkit-gradient(linear, left top, left bottom, from(#161693), to(#000326));
    background: -moz-linear-gradient(top, #161693, #000326);
    background: linear-gradient(to bottom, #161693, #000326);
}
Run Code Online (Sandbox Code Playgroud)

bia*_*hai 8

你忘了宣布type of button这样的:

input type = "button"

默认typeinputIS text(文本字段).

  • OP得到了这份工作!:) (3认同)