请分析一下下面的原因:
    开始提示我对象没有定义,当我把ip1,ip2,ip3,ip4都定义后,仍然提示我“对象为空或不是对象?”为何????????????

解决方案 »

  1.   

    你的代码没问题 :)
    windows2000Ser+IE6.0SP1可能不在这代码里面.
      

  2.   

    但是这样怎么会处错呀???
    <html>
    <head>
    <meta  http-equiv="Content-Type"  content="text/html;  charset=gb2312">
    <meta  name="GENERATOR"  content="Microsoft  FrontPage  4.0">
    <meta  name="ProgId"  content="FrontPage.Editor.Document">
    <style>
    .a3{width:25;border:0;text-align:center}
    </style>
    <script>
    function  mask(obj){
    obj.value=obj.value.replace(/[^\d]/g,'')
    key1=event.keyCode
    if  (key1==37  ||  key1==39)
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))
    nextip=key1==37?nextip-1:nextip+1;
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    eval("ip"+nextip+".focus()")
    }  
    if(obj.value.length>=3)  
    if(parseInt(obj.value)>=256  ||  parseInt(obj.value)<=0)
    {
    alert(parseInt(obj.value)+"IP地址错误!")
    obj.value=""
    obj.focus()
    return  false;
    }
    else  
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))+1
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    eval("ip"+nextip+".focus()")
    }
    }
    function  mask_c(obj)
    {
    clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))
    }</script>
    <title>IP地址输入</title></head>
    <body>
    <form name="login" action="111.asp">
    IP地址输入
    <div  style="border-width:1;border-color:balck;border-style:solid;width:150;font-size:8pt">
    <input  type=text  name="ip1"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip2"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip3"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip4"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">
    </div>
    </form>
    </body>
    </html>
      

  3.   

    <html>
    <head>
    <meta  http-equiv="Content-Type"  content="text/html;  charset=gb2312">
    <meta  name="GENERATOR"  content="Microsoft  FrontPage  4.0">
    <meta  name="ProgId"  content="FrontPage.Editor.Document">
    <style>
    .a3{width:25;border:0;text-align:center}
    </style>
    <script>
    function  mask(obj){
    obj.value=obj.value.replace(/[^\d]/g,'')
    key1=event.keyCode
    if  (key1==37  ||  key1==39)
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))
    nextip=key1==37?nextip-1:nextip+1;
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    eval("ip"+nextip+".focus()")
    }  
    if(obj.value.length>=3)  
    if(parseInt(obj.value)>=256  ||  parseInt(obj.value)<=0)
    {
    alert(parseInt(obj.value)+"IP地址错误!")
    obj.value=""
    obj.focus()
    return  false;
    }
    else  
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))+1
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    //原来是:eval("ip"+nextip+".focus()")改了一下,行了.
    eval("document.login.ip"+nextip+".focus()")
    }
    }
    function  mask_c(obj)
    {
    clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))
    }</script>
    <title>IP地址输入</title></head>
    <body>
    <form name="login" action="111.asp">
    IP地址输入
    <div  style="border-width:1;border-color:balck;border-style:solid;width:150;font-size:8pt">
    <input  type=text  name="ip1"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip2"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip3"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">.
    <input  type=text  name="ip4"  maxlength=3  class=a3  onkeyup="mask(this)"  onbeforepaste="mask_c()">
    </div>
    </form>
    </body>
    </html>
      

  4.   

    1.将你的ip1等定义为id试
    2.eval("document.all.ip"+nextip+".focus()")
      

  5.   

    我放在asp的页面中仍然出现:
    "ip2没有定义“

    ”ip3没有定义“

    ”ip4没有定义“
      

  6.   

    <HTML>
    <HEAD>
    <TITLE>aaaa</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    <link href="../inc/style.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function  mask(obj)
    {
    obj.value=obj.value.replace(/[^\d]/g,'')
    key1=event.keyCode
    if  (key1==37  ||  key1==39)
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))
    nextip=key1==37?nextip-1:nextip+1;
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    eval("ip"+nextip+".focus()")
    }  
    if(obj.value.length>=3)  
    if(parseInt(obj.value)>=256  ||  parseInt(obj.value)<=0)
    {
    alert(parseInt(obj.value)+"IP地址错误!")
    obj.value=""
    obj.focus()
    return  false;
    }
    else  
    {  obj.blur();
    nextip=parseInt(obj.name.substr(2,1))+1
    nextip=nextip>=5?1:nextip
    nextip=nextip<=0?4:nextip
    eval("ip"+nextip+".focus()")
    }
    }
    function  mask_c(obj)
    {
    clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))
    }
      --->
     </script>
    </HEAD>
    <BODY BGCOLOR=#E7E7E7 LEFTMARGIN=7 TOPMARGIN=7 RIGHTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
      <table width="100%" border="1" cellpadding="3" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
                  <form name="login" method="post" action="act_config.asp?action=add_seat">
                    <tr bgcolor="#D1D1D1"> 
                      <td height="24" colspan="2" align="center">添加座席</td>
                    </tr>
                    <tr> 
                      <td width="13%" align="center">IP设置</td>
                      <td width="87%">
      <div style="border-width:1;BACKGROUND-COLOR:white;border-style:solid;width:140;height:20;">
                       <input type="text" name="ip1" maxlength=3  class="a3" onkeyup="mask(this)" onbeforepaste="mask_c()">.
                       <input type="text" name="ip2" maxlength=3  class="a3" onkeyup="mask(this)" onbeforepaste="mask_c()">.
                       <input type="text" name="ip3" maxlength=3  class="a3" onkeyup="mask(this)" onbeforepaste="mask_c()">.
                       <input type="text" name="ip4" maxlength=3  class="a3" onkeyup="mask(this)" onbeforepaste="mask_c()">
                      </div>    
                      </td>
                    </tr>
                    <tr> 
                      <td align="center">座席号</td>
                      <td><input name="SEATNUM" type="text" id="SEATNUM" onkeyup="device_id(this)" size="2">
                        【只能输入1-10】</td>
                    </tr>
                    <tr> 
                      <td align="center">备注信息</td>
                      <td><textarea name="NOTES" cols="80" rows="6" id="NOTES"></textarea></td>
                    </tr>
                    <tr> 
                      <td colspan="2" align="center"> <input type="submit" name="Submit" value="提交" class="unite"> 
                        &nbsp;&nbsp; <input type="reset" name="reset" value="重置" class="unite"></td>
                    </tr>
                  </form>
              </table>
    </BODY>
    </HTML>
    保存为ip.asp调试吧!谢谢
      

  7.   

    eval("ip"+nextip+".focus()")你的代码还是没有改啊 :(//原来是:eval("ip"+nextip+".focus()")改了一下,行了.
    eval("document.login.ip"+nextip+".focus()")
      

  8.   

    昨天的问题,再请教一下:
    IP输入两位时按向左键和向右键(“->”和“〈-”)时同样会出错,能不能这样:
    按向左键跳到上一个输入框,按向右键跳到下一个输入框?拜托了,谢谢