Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q2075

Feedback on: irt.org FAQ Knowledge Base Q2075

Sent by michel on June 15, 2001 at 16:47:28: - feedback #2850

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


Sent by Tri DangTran on July 26, 2001 at 17:22:34: - feedback #3013

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 :(


©2018 Martin Webb