to muxrwc
<html
<head>
<script type= "text/javascript ">
function $(id) {
return document.getElementById(id);
}
function kc(e) {
var e = window.event || e;
var o = e.srcElement || e.target;
var code = e.keyCode || e.which;
var string = String.fromCharCode(code);
var number = parseInt(string);
var num = /[^\d]/;
var ar;
if (num.test(string)) return false;
else {
switch (o.value.length) {
case 0:
case 1:
case 2:
case 4:
return true;
case 5:
if (number > 1) return false;
case 7:
case 8:
ar = o.value.split( "- ");
if (parseInt(ar[1]) == 2 && number > 2) return false;
else if (number > 3) return false;
case 9:
ar = o.value.split( "- ");
if ((parseInt(ar[1]) == 2 && parseInt(ar[0]) % 4 != 0 && number > 8) ||
(parseInt(ar[2]) == 3 && number > 1) ||
(parseInt(ar[2]) == 0 && number == 0)) return false;
return true;
case 3:
if (parseInt(o.value) == 0 && number == 0) return false;
o.value += string + "- ";
return false;
case 6:
if (parseInt(o.value.split( "- ")[1]) == 0 && number == 0) return false;
if (number > 2) return false;
o.value += string + "- ";
default:
return false;
}
}
}
window.onload = function () {
$( "wc ").onkeypress = kc;
}
</script>
</head>
<body>
<input id= "wc " />
</body>
</html>
还记的这个吗 ? 这个功能在firefox下不可以 帮忙看看 谢谢 !
------解决方案--------------------我测试了啊。米问有问题的说。。
你测试哪里有问题?
我的是
Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2