]<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>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn