======How to assign a JavaScript behavior to a tag?======
It is tempting to use event handlers in the old way - that is, by putting the code directly on the tag's handler, like so:
...it is no possible longer to do so in the UWA environment, where the ''pieceOfCode'' method above would need to be set globally, which can't be done.
It is therefore recommended to dynamically assign the behavior, through JavaScript:
widget.onLoad = function() {
var textarea = widget.body.getElementsByTagName("textarea")[0];
textarea.onfocus = function() { ... }
}
This has the added bonus of preventing the cluttering of the HTML code with JavaScript events...