You are here: irt.org | About | Feedback | 2850 [ previous next ]
Feedback on:
irt.org FAQ Knowledge Base Q2075
Sent by
michel on June 15, 2001 at 16:47:28:
Comments:
Here is one for IE and netscape4 both
<html>
<head>
<head>
<script>
if (document.all)
document.write('<sty'+'le> .rgt { text-align:right } </sty'+'le>');
function reformat() {
var padding = this.maxLength - this.value.length;
for (i = 0; i < padding; i++) {
this.value = " " + this.value;
}
return true;
}
function unformat() {
var content = this.value
var spaces = content.lastIndexOf(" ");
this.value = content.substring(spaces+1,this.value.length);
return true;
}
</head>
<body>
<form name="test">
.
.
.
<input type=text name=tfield class="rgt" size=10 maxlength=10>
</form>
<script>
if (navigator.appName=='Netscape') {
document.test.tfield.maxLength=10;
document.test.tfield.onblur=reformat;
document.test.tfield.onfocus=unformat;
}
</script>
</body>
</html>
The format and unformat curtesy of
Seb Barre
Other feedback on 'irt.org FAQ Knowledge Base Q2075' - show all