:
复制代码代码如下:
<! 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">
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Title> 无标题文档 </TITAL>
<style type = "text / css">
.ClearFieldBlurred {
Couleur: #ccc;
Style de police: italique;
Police-poids: normal;
Largeur: 150px;
}
.ClearFieldactive {
Couleur: # 4E4E4E;
Police-poids: Bold;
Largeur: 150px;
}
</ style>
<script type = "text / javascript">
fonction clearfiled () {
var bbb = document.getElementById ("bbb");
if (bbb.value == "bbb") {
bbb.value = '';
bbb.classname = 'clearFieldactive';
}
}
window.Document.onmousedown = function () {
var bbb = document.getElementById ('bbb');
if (bbb.value == "") {
bbb.value = 'bbb';
bbb.classname = 'clearfieldblurred';
}
}
</cript>
</ head>
<body>
<input type = "text" id = "aaa" value = "aaa" onfocus = "if (this.value == 'aaa') {this.value = ''; this.classname = 'clearFieldactive';}" onBlur = "if (this.value == '') {this.value = 'aaa'; this.classname = 'clearfieldblurred';}" />
<br />
<input type = "text" id = "bbb" value = "bbb" onclick = "clearfiled ()" />
</docy>
</html>