Changing the colour of part of a text area

    Date: 06/04/06 (Javascript Community)    Keywords: java

    I think that this is an example of me flogging a dead horse, but I'll ask anyway:

    Is it possible to change the text colour (or, rather, the color) of part, but not all, of a textarea?

    I'm using a textarea as field in which a user can enter the body of an SMS message. The length of the message is limited to 138 characters (US Carriers restrict you to 150 per message and you need to have " STOP to end" on the end of it, so 138 it is).

    I've been indicating that a person has overrun the maximum message length in two ways. Firstly, by changing the text color to red once the user overruns the limit and then, when the client changed their mind, by truncating the message to the 138 character limit if the user goes over it. Additionally there's a counter under the textarea that tells the user how many characters they have left to play with.

    Now the client (curse them) has changed their mind again. Instead of either of the two methods mentioned above (both of which were their idea, by the way) they want any excess text to be red - but only the excess text. Text that is within the 138 character limit should stay black.

    So the question again, folks, is: Is this possible? I get the feeling it's not, but I'm not a JavaScript guru.

    Source: http://community.livejournal.com/javascript/101189.html

« the-name-of-this-file || Graphing Package »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home