<zk>
<window xmlns:w="http://www.zkoss.org/2005/zk/client" width="740px">
<textbox id="message" multiline="true" width="540px" height="150px">
<attribute w:name="onKeyUp"><![CDATA[
var val = this.getInputNode().value,
cleanList = [],
tempList = val.split('\n');
for (var i=0; i<tempList.length;i++) {
var cleanS = tempList[i].substring(0,4);
cleanList.push(cleanS);
}
if (cleanList.length > 5) {
cleanList.pop(); //remove last line
}
this.setValue(cleanList.join('\n'));
zk.log(cleanList);
]]></attribute>
</textbox>
</window>
</zk>