html文件中的文本框
<input type="text" name="initValue" size="20" value='<bean:write name="sysParaForm" property="initValue"/>' onkeypress="return onKeyPressForDouble(this,event)">
<script language="JavaScript" type="text/JavaScript">
//输入正Double型数值
//设置控件的onkeypress事件 // dlt add this method
//参数说明:
// 1) o 为拥有value属性控件对象
// 2) event 为 事件对象
function onKeyPressForDouble(o,event)
{
//alert("Ok");
var keyChar = String.fromCharCode(event.keyCode);
var value = o.value;
var numstr = "0123456789.";
if (numstr.indexOf(keyChar)>-1){
if ((keyChar == ".") && (value.indexOf(".")>-1))
{
event.keyCode=0;
}
}else
{
event.keyCode=0;
}
return true;
}
</script>