Feedback on: irt.org FAQ Knowledge Base Q2075
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
Worth:
Very worth reading
Technical:
Not technical enough
Comments:
Regarding how to right align text inside INPUT tag in Netscape:
The solution provided by Michel
still does not work for Netscape4
(!) although it does for IE: I
thoroughly tested it!!!
Any other suggestion how to do this? I'm stuck with above
problem :(