时间格式问题
一个输入框 当我用鼠标选择网页中2000.11.10时 将其拖到输入框中 输入框中将自动转化成2000-11-10
同理如果是2000年11月10日 也要转化成2000-11-10
谢谢
------解决方案-------------------- <script type= "text/javascript ">
var temp = " ";
function aa(obj)
{
var value = obj.value;
value = value.replace(/十一/g, "11 ");
value = value.replace(/十二/g, "12 ");
value = value.replace(/十三/g, "13 ");
value = value.replace(/十四/g, "14 ");
value = value.replace(/十五/g, "15 ");
value = value.replace(/十六/g, "16 ");
value = value.replace(/十七/g, "17 ");
value = value.replace(/十八/g, "18 ");
value = value.replace(/十九/g, "19 ");
value = value.replace(/○/g, "0 ");
value = value.replace(/零/g, "0 ");
value = value.replace(/一/g, "1 ");
value = value.replace(/二/g, "2 ");
value = value.replace(/三/g, "3 ");
value = value.replace(/四/g, "4 ");
value = value.replace(/五/g, "5 ");
value = value.replace(/六/g, "6 ");
value = value.replace(/七/g, "7 ");
value = value.replace(/八/g, "8 ");
value = value.replace(/九/g, "9 ");
value = value.replace(/十/g, "0 ");
value = value.replace(/\D/g, "- ");
if(value.substring(value.length - 1, value.length) == "- ")
value = value.substring(0 , value.length - 1);
value = value.replace(temp, " ");
temp = value;
obj.value = value;
}
</script>
<input id= "a " name= "a " type= "text " onFocus= "javascript:aa(this); ">