DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   how to change the aligment of a textarea (http://www.daniweb.com/forums/thread102998.html)

dks1383 Dec 31st, 2007 2:55 am
how to change the aligment of a textarea
 
Hi all

How can I write a javascript code to change the alignment of a textarea so that the user can select a part of of a textarea and change the alignment of this part by clicking a button?
thanks

MidiMagic Jan 1st, 2008 1:33 am
Re: how to change the aligment of a textarea
 
Try the textAlign style.

But it may not work. The text alignment of a text box or a text area depends on the data type it is used for.

temp304 Jan 3rd, 2008 9:30 am
Re: how to change the aligment of a textarea
 
text-align Attribute | textAlign Property

Sets or retrieves whether the text in the object is left-aligned, right-aligned, centered, or justified


The property is read/write for all objects except the following, for which it is read-only: currentStyle . The property has a default value of left . The Cascading Style Sheets (CSS) attribute is inherited.

Applies To: BLOCKQUOTE , BODY , CENTER , currentStyle , DD , DIR , DIV , DL , DT , FIELDSET , FORM , hn , HR , INPUT type=password , INPUT type=text , LI , LISTING , MARQUEE , MENU , OL , P , PLAINTEXT , PRE , runtimeStyle , style , TABLE , TD , TEXTAREA , TH , TR , UL , XMP

Fungus1487 Jan 3rd, 2008 11:05 am
Re: how to change the aligment of a textarea
 
but you still wont be able to align PART of the text differently to another part. Not in the same textbox anyway.


All times are GMT -4. The time now is 3:51 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC