Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field justification & length

Status
Not open for further replies.

CJason

Programmer
Joined
Oct 13, 2004
Messages
223
Location
US
I am wanting to loop through all the fields on my form, find the ones that are right-justified, and pad them on the left with spaces...to fill out the entire field length.

I have the looping and padding algorithms, but I don't know how to tell if the field is right justified...nor, the maximum length of the field.

Any ideas?

Thanks in advance!
 
To see if a field is right justified, check its text-align mstyle and see if it set to "right":

Code:
alert(obj.style.textAlign);

to check its maximum lenth, check its maxlength property:

Code:
alert(obj.maxlength);

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
So, I should be able to do something like:

document.form[0].element[1].style.textAlign

and

document.form[0].element[1].maxlength

Thanks!
 
Sorry, one more thing. Is there a way to tell if a field is readonly or not?

Thanks again...and again!!!
 
Make sure to capitalize the O in read[!]O[/!]nly

-kaht

[small] <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
[banghead] [small](He's back)[/small]
 
Aah - thanks for that. I was thinking as I posted "Does the O need to be capitalised", then thought that it didn't, as when using getAttribute it didn't.

Of course, if not using getAttribute, then it does!



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top