初始化 ODJO

 <script djConfig="parseOnLoad: true, isDebug: true, locale:'zh-cn'"
 src="<%=Context%>/javascript/dojo/dojo.js"></script> 
 <style type="text/css"> 

 @import"<%=Context%>/javascript/dijit/themes/tundra/tundra.css"; 

 @import"<%=Context%>/javascript/dojo/resources/dojo.css"; 
</style>
 <script type="text/javascript"> 

 function createDojoDateBox(inputId) { 



 var inputObj = dojo.byId(inputId); 



 inputObj.setAttribute("dojoType","dijit.form.DateTextBox"); 



dojo.parser.instantiate([inputObj]);

}

 function createDojoTextBox(inputId) { 



 var inputObj = dojo.byId(inputId); 



 inputObj.setAttribute("dojoType","dijit.form.TextBox"); 



dojo.parser.instantiate([inputObj]);

}

 function createDojoValidationTextBoxForEmail(inputId){ 



 var inputObj = dojo.byId(inputId); 
 inputObj.setAttribute("dojoType","dijit.form.ValidationTextBox"); 
 inputObj.setAttribute("promptMessage","请输入 Email 地址"); 
 inputObj.setAttribute("invalidMessage","请输入正确格式的 Email"); 
 inputObj.setAttribute("required","true"); 
 inputObj.setAttribute("trim","true"); 
inputObj.setAttribute("regExp",
"^[A-Za-z0-9](([_.-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+) 
(([.-]?[a-zA-Z0-9]+)*).([A-Za-z]{2,})$");
dojo.parser.instantiate([inputObj]);
}
</script>
 <body class="tundra"> 
 <h1 class="testTitle"> 雇员信息 </h1><br /> 
<div>
 <label> 编号:</label> 
 <input type="text"id="eid"onfocus="createDojoTextBox('eid')"value="51246"/><br /> 
 <label> 姓名:</label> 
 <input type="text"id="ename"onfocus="createDojoTextBox 
 ('ename')"value="ThinkVision"/><br /> 
 <label> 职务:</label> 
 <input type="text"id="duty"onfocus="createDojoTextBox('duty')"value="工程师"/> 
 <br /> 
 <label> 电子邮箱:</label> 
 <input type="text"id="email"onfocus="createDojoValidationTextBoxForEmail 
 ('email')"value="[email protected]"/><br /> 
 <label> 入职时间:</label> 
 <input type="text"id="onboard"onfocus="createDojoDateBox 
 ('onboard')"value="09-04-29"/><br /> 
</div>

你可能感兴趣的:(初始化)