我一直在尝试用我之前有人写过的表格解决问题,并且出于某种原因,当有人输入日期时(例如01/02/2014)IE(所有版本)切断了最后一位数,所以今年阅读01/02/201。
任何想法可能导致什么?
<td colspan="6">Dates Worked: From
<input type="text" name="workdatesfrom1"
style="width:80px" maxlength="10"
value="<?php
if($workdatesfrom1<>'01/01/1900') {
print($workdatesfrom1);
}
?>"
maxlength="10" id="workdatesfrom1"
onFocus="javascript:vDateType='1'"
onKeyDown="DateFormat(this,this.value,event,false,'1')"
onBlur="DateFormat(this,this.value,event,true,'1')"
OnKeyUp="textCounter(
document.getElementById('app2').workdatesfrom1,
document.getElementById('app2').workdatesto1,
10
)"
/>
</td>
JS:
function textCounter(field, tabfield, maxlength) {
if (field.value.length == maxlength) // get to max then tab
tabfield.focus();
return;
}