js 只能限制只能输入数字和转大写方法
function OnlyNumText()
{
if (event.keyCode >= 48 && event.keyCode <= 57) {
return true;
}else{
window.event.keyCode = \’\’;
}
}
function UpperString(tag)
{
var temp=document.getElementById(tag.id);
if(temp!=null){
document.getElementById(tag.id).value=temp.value.toUpperCase();
}
}
使用:
<jf:inputText value=”#{employeePageBean.employee.alOpening}” maximumLength=”9″ onkeypress=”javascript:OnlyNumText()”>
<f:validateLongRange maximum=”999999999″/>– 限制只能输入数字位数
</jf:inputText>
<jf:inputText value=”#{employeePageBean.employee.hkid}” maximumLength=”50″ onblur=”UpperString(this)”></jf:inputText>