[thelist] HTC behaviors? (was "Text area question")

James Aylard evolt at pixelwright.com
Wed Mar 17 10:17:09 CST 2004


John.Brooking at sappi.com wrote:

>> Put 51 characters in the Windows buffer. Place the mouse in the
>> textarea. Right-click. Select Paste. You now have 51 characters in
>> your textarea.
>
> Good point! I don't have the time to try it right now, but I guess
> one would have to add some more checks to onBlur, onChange, or
> something to get the complete solution. I'll try to come up with one
> later on to add as a tip, as someone else suggested to me off-line.

    Using the onchange method would be the cross-browser way to do it,
although it requires that the user navigate away from the field before it
fires, so it lacks immediacy, and therefore could be confusing and a bit
clunky for users. But once checked, you could simply truncate a value that
is too long.
    In IE 5+, you can use the IE-proprietary onpaste event to check the
value of the textarea the moment it is pasted. In some code that I wrote a
couple of years ago, I found it necessary to allow a brief pause (10ms)
between the firing of the onpaste event and the validation of the textarea
value. But since its effect is immediate, it is a more-intuive,
less-confusing approach for users.

> Meanwhile, the thread has since opened up another question for me:
>> Look at http://www.siteexperts.com/ie5/htc/ts08/page1.asp .
>
> The siteexperts article, as well as several of the Google result
> pages, recommended implementing various "custom behaviors" using an
> HTC file. I've seen this technology briefly before, but am not
> well-acquainted with it. I always thought it was a Microsoft-specific
> thing, but some of the pages I looked at seem to indicate it's a CSS
> thing. It also seems to use XML. Can someone explain briefly what it
> is, whether it is a standard, and how well various browsers support
> it?

    It is a Microsoft thing, although it uses some XML syntax and typically
employs a combination of script and CSS. Take a look at Microsoft's HTC
reference [1] and Behaviors reference [2] for a lot more detail.

1. http://msdn.microsoft.com/workshop/components/htc/reference/htcref.asp
2.
http://msdn.microsoft.com/workshop/author/behaviors/behaviors_node_entry.asp

James Aylard



More information about the thelist mailing list