1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<html>
<head>
<script language="javascript">
function replaceMe(thefield,newname)
{
var oldfield = document.getElementById(thefield);
var theparent = oldfield.parentNode;
for (i=0; i<theparent.elements.length; i++)
{
if (theparent.elements[i].name == thefield) theindex = i;
}
var newfield = document.createElement("input");
newfield.setAttribute("type","password");
newfield.setAttribute("name",newname);
theparent.replaceChild(newfield,oldfield);
window.setTimeout("document.forms.monform.elements[theindex].focus()",1);
}
</script>
</head>
<body>
<form name="monform">
<input type=text name="nom" value="Votre nom">
<br>
<input type=text name="version1" value="Votre mot de passe" onfocus="replaceMe(this.name,'password')">
</form>
</body>
</html> |
Partager