我創建了一個包含一系列文本字段的非常基本的html表單。我只是在尋找一種方法,如果輸入了某個值,則會在字段的右側顯示綠色檢查。我嘗試了一些CSS(不太瞭解),但無濟於事。有任何想法嗎?我一直在尋找一段時間。這是我到目前爲止。由於想要一個綠色的複選標記出現在文本字段的右側
<!DOCTYPE html>
<html>
<head>
<title>CRM Application Form</title>
<style type="text/css">
label.valid {
width: 24px;
height: 24px;
background: url(assets/img/valid.png) center center no-repeat;
display: inline-block;
text-indent: -9999px;
}
label.error {
font-weight: bold;
color: red;
padding: 2px 8px;
margin-top: 2px;
}
</style>
</head>
<body>
<h1 style="text-align:center">CRM Application Form</h1>
<form>
<fieldset style="background-color:lightgray">
<legend style="font-weight:600">Personal Information</legend>
Date of Birth:
<input type="date" id="DOB" name="DOB" required><br>
Social Security #:
<input type="text" id="SS#" name="SS#" value="" onchange="checkField(this.value)"><br>
Location:
<input type="text" id="Location" name="Location" /><br>
Ethnicity:
<input type="text" id="Ethnicity" name="Ethnicity" /><br />
Citizenship:
<input type="radio" id="Yes" name="Yes" value="Yes" />Yes
<input type="radio" id="No" name="No" value="No" />No<br />
Gender:
<input type="text" id="Gender" name="Gender" /><br />
Marital Status:
<input type="text" id="Marital Status" name="Marital Status" /><br />
Previous Last Name:
<input type="text" id="PLN" name="PLN" /><br />
</fieldset>
<fieldset style="background-color:lightgray">
<legend style="font-weight:600">Contact Information</legend>
Address:
<input type="text" id="Address" name="Address" required><br />
Email:
<input type="email" id="email" name="email" required><br />
</fieldset>
<fieldset style="background-color:lightgray">
<legend style="font-weight:600">Education</legend>
Education History:
<input type="text" id="EH" name="EH" /><br />
Academic Level:
<input type="text" id="AL" name="AL" /><br />
</fieldset>
<fieldset style="background-color:lightgray">
<legend style="font-weight:600">Other Information</legend>
Military Status:
<input type="text" id="MS" name="MS" /><br />
POI:
<input type="text" id="POI" name="POI" /><br>
Employment Goal:
<input type="text" id="EG" name="EG" /><br />
Program:
<input type="text" id="Program" name="Program" /><br />
Market Segment:
<input type="text" id="Mkt" name="Mkt" /><br />
FA:
<input type="checkbox" id="FA" name="FA" />
Payment:
<input type="checkbox" id="Payment" name="Payment" /><br />
Notes:<br />
<textarea id="Notes" name="Notes"> </textarea><br />
</fieldset>
<input type="submit" />
</form>
</body>
</html>
等都不是 「寫我的代碼爲我」 的網站。如果您有特定的問題,請隨時提出一個新問題。 – Scimonster 2014-11-05 19:22:24
@Scimonster他並沒有要求某人爲他寫代碼 - 儘管我猜他會這麼做的。 – 2014-11-05 19:25:37
@NicholasKyriakides是的,因爲沒有現有的JS試圖做到這一點。 – Scimonster 2014-11-05 19:26:34