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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Align text in a text area

Status
Not open for further replies.

greyone

Programmer
Dec 14, 2000
200
CA
Say I have the following data:

Raj**SymingtonAvenue$$NiTin**Toronto$$MaHeSH**St Clarens
Avenue$$GErry**Ajax

I want to align these elements in a stright line in a text area like
this:

Raj SymingtonAvenue
NiTin Toronto
MaHeSH St Clarens
GErry Ajax

This I am not able to do. My logic is
--- write the first value, write (40-(# of chars in first value))
spaces, write second value, newline and so on.

But the alignment isnt perfect since (40-(# of chars in first value))
spaces is not a true measure of the length of the first value. Strings with more uppercase letters take more space so the alignment is
coming like:

Raj SymingtonAvenue
NiTin Toronto
MaHeSH St Clarens
GErry Ajax

So how can I get perfect alignment using JavaScript??

Please help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top