Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: irt.org FAQ Knowledge Base Q2075

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


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 21st December 2007. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.