:
复制代码代码如下:
<! 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" xml: lang = "en" lang = "en">
<adal>
<Title> HTML 文本框提示效果 </TITME>
<style type = "text / css">
* {
marge: 0px; rembourrage: 0px; taille de police: 12px;
}
saisir{
Largeur: 100px; hauteur: 20px; bordure: 1px solide #ccc;
}
</ style>
</ head>
<body>
<script linguisse = "javascript">
Conseils de fonction (id, str) {
var l = document.getElementById (id) .offsetleft + 120;
var t = document.getElementById (id) .OffSetTop;
document.getElementById ("TIPS"). innerHtml = "提示 :" + str;
document.getElementById ("TIPS"). Style.left = L + "PX";
document.getElementById ("TIPS"). Style.top = T + "PX";
document.getElementById ("TIPS"). Style.display = "";
}
fonction outtips () {
document.getElementById ("TIPS"). Style.display = 'Aucun';
}
</cript>
<div id = "TIPS" Style = "Position: Absolute; Border: 1px Solid #ccc; Padding: 0px 3px; Couleur: # f00; Affichage: Aucun; High: 20px; Line-Height: 20px; arrière-plan: #fcfcfc"> </ div>
<br />
姓名 : <input type = "text" id = "username" onfocus = "Tips ('username', '姓名长度最多 16 个字符')" onblur = "outtips ()" />
<br />
密码 : <entrée type = "mot de passe" id = "mot de passe" onfocus = "TIPS ('Mot de passe', '密码长度必须在 3-18 位之间')" onblur = "outtips ()" />
</docy>
</html>