]<script>
function checkNumber(e,txt)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromCharCode(key);
var el = document.getElementById('test');
var msg = document.getElementById('msg');
reg = /\d|\./;
var result = reg.test(keychar);
if(result)
{
if(e.keyCode==46)
result=!(txt.value.split('.').length>1);
else
result=!(txt.value.split('.').length>1&&txt.value.split('.')[1].length>1);
}
if(!result)
{
el.className = "warn";
msg.innerHTML = "只能输入数字";
return false;
}
else
{
el.className = "";
msg.innerHTML = "";
return true;
}
}
</script>