<script ID="clientEventHandlersJS" LANGUAGE="javascript" type="text/javascript" >
<!--
function startyear_onkeyup() {
if(document.FieldSearchForm.start_year.value.length==4){
     document.FieldSearchForm.start_month.focus();
   }

function start_month_onkeyup() {
if(document.FieldSearchForm.start_month.value.length==2){
     document.FieldSearchForm.start_day.focus();
   }
}</script><form method="post" name="FieldSearchForm"> <INPUT
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
    size=4 maxLength=4
name=start_year 
style="width: 40px" 
onKeyUp="return startyear_onkeyup()">

<INPUT
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
size=2 maxLength=2
name=start_month style="width: 20px" onKeyUp="return start_month_onkeyup()">

<INPUT
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
size=2 maxLength=2
name=start_day style="width: 20px">

在红色代码部分总是提示“缺少对象”!各位大大帮忙看看!! 谢谢!!!

解决方案 »

  1.   

    已经添加type="text"  还是报缺少对象!!!
      

  2.   

    我用IE8和FF试了都没报错……奇怪
    把lz的代码贴过来之后我只封闭了form标签并删除了颜色代码,其它啥都没动……
      

  3.   

    FF下测试可以。IE我现在没有环境。
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    <script id="aa" LANGUAGE="javascript" type="text/javascript" >function startyear_onkeyup() {
    if(document.FieldSearchForm.start_year.value.length==4){
         document.FieldSearchForm.start_month.focus();
       }

    function start_month_onkeyup() {
    if(document.FieldSearchForm.start_month.value.length==2){
         document.FieldSearchForm.start_day.focus();
       }
    }</script> </head>
    <body>
    <form method="post" name="FieldSearchForm">        <INPUT
                                            onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                                            size=4 maxLength=4
                                            name=start_year 
                                            style="width: 40px" 
                                            onKeyUp="return startyear_onkeyup()">
                                        年
                                        <INPUT
                                            onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                                            size=2 maxLength=2
                                            name=start_month style="width: 20px" onKeyUp="return start_month_onkeyup()">
                                        月
                                        <INPUT
                                            onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
                                            size=2 maxLength=2
                                            name=start_day style="width: 20px">
                                        日 </body>
    </html>