04/01/2007 - 20:35 — criecke
<FORM>
姓: <input type="text" length="20" name="first" dojoType="dijit.form.Textbox"
trim="true" ucfirst="true" /><br/>
名: <input type="text" length="20" name="last" dojoType="dijit.form.Textbox"
trim="true" ucfirst="true" /><br/>
邮件地址: <input type="text" length="20" name="email" dojoType="dijit.form.Textbox"
lowercase="true"/><br/>


去除空格和改变大小写
文本框的dijit提供了额外的属性










把trim设为"true"使得dijit.form.Textbox在数据前后去除空格,当文本框失去焦点,dojo自动的修改内容,并放回文本框中。去除空格对数据库操作常常非常有用,因为首尾的空格经常导致查询失效。
ucfirst 和lowercase属性非常的相近。分别是让输入的字母大写和输入小写,当文本框失去焦点,ucfirst只改变小写的字母,所有大小的字母都保持不变。同样的,lowercase只改变大小字母。