当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

 ·关于98系统时间的问题    »显示摘要«
    摘要: 技术时间如何改成24小时制?我的是12小时制的. ......
 ·sos: 只要你的建议 *^*    »显示摘要«
    摘要: 我是vb程序员,自认为有点火候了.. 现在想学jave 但一看有什么j2se , j2ee ,ejb ,jms 什么的,这些东东都是些什么呀? 我该从哪块地方入手学习呀? 请有经验的小虾,中虾, 大虾们点化一下...ok? ......


如何对动态生成的输入框进行操作

网页上动态生成输入框,名称为input1....inputn,n是不确定的,想写个函数能够给这些输入框赋值,请问如何操作?

NO.1   作者: yanzy

<script   language=javascript>  
  var   tmp_stra;  
  tmp_stra="<%=tmpstr%>";  
  function   check()  
  {  
  var   tmp_str1;  
  var   tmp_str="";  
  for(ii=1;ii<=document.all("upcount").value;ii++)  
  {  
  if   (document.all("text"+ii).value==)  
        {  
        alert   ("请输入字段说明!");  
        document.all("text"+ii).focus();  
        return   false;    
        }  
  if   (document.all("texta"+ii).value==)  
        {  
        alert   ("字段名没有输入!");  
        document.all("texta"+ii).focus();  
        return   false;        
        }  
  if   ((document.all("texta"+ii).value==id)||(document.all("texta"+ii).value==date_atime_a)||(document.all("texta"+ii).value==luru_aid_a)||(document.all("texta"+ii).value==shenhe_aid_a)||(document.all("texta"+ii).value==is_ashenhe_a)||(document.all("texta"+ii).value==auditing_atime_a)||(document.all("texta"+ii).value==is_aexpires_a)||(document.all("texta"+ii).value==isformat_a))  
        {  
        alert   ("系统检测到与系统关键词重复!请更换字段名!");  
        document.all("texta"+ii).focus();  
        return   false;  
        }  
   
  tmp_str1=document.all("texta"+ii).value;  
  var   tmp_str3="|";  
  tmp_str3=tmp_str3.concat(tmp_str1);  
  tmp_str1=tmp_str3.concat("|");  
  if   (tmp_str.indexOf(tmp_str1)==-1)  
        {  
        tmp_str=tmp_str.concat(tmp_str1);  
        }  
        else  
        {  
        alert   ("系统检测到有重复字段名!请修改");  
        document.all("texta"+ii).focus();  
        return   false;  
        }  
   
  if   (tmp_stra.indexOf(tmp_str1)!=-1){  
        alert   ("系统检测字段与现有字段重名!请修改");  
        document.all("texta"+ii).focus();  
        return   false;  
          }  
  }  
  }  
  </script>  
  <html>  
  <head>  
  <meta   http-equiv="Content-Language"   content="zh-cn">  
  <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">  
  <title></title>  
  <link   rel="stylesheet"   href="../jscss/main.css"   type="text/css">  
  </head>  
  <body   background="../IMAGES/bg1_2.gif"   leftmargin="0"   topmargin="0"   marginwidth="0"   marginheight="0">  
  <table   border="1"   width="100%"   bordercolorlight="#000000"   cellspacing="0"   cellpadding="4"   bordercolordark="#FFFFFF">  
  <tr><td>字段说明</td><td>字段名</td><td>字段类型</td></tr>  
  <%  
  for   i=0   to   re.fields.count-1  
  if   not   (re(i).name="id"   or   re(i).name="date_atime_a"   or   re(i).name="luru_aid_a"   or   re(i).name="shenhe_aid_a"   or   re(i).name="is_ashenhe_a"   or   re(i).name="auditing_atime_a"   or   re(i).name="is_aexpires_a"   or   re(i).name="isformat_a")   then  
  response.write   "<tr><td>"  
  rs1.movefirst  
  do   while   not   rs1.eof  
  if   trim(rs1("fieldname_a"))=trim(re(i).name)   then  
  response.write   rs1("fieldexplain")  
  end   if  
  rs1.movenext  
  loop  
  response.write   "&nbsp;"  
  response.write   "</td><td>"  
  response.write   re(i).name  
  response.write   "</td><td>"  
  select   case   re(i).type  
  case   130  
  response.write   "文本型"  
  case   3  
  response.write   "数值型"  
  case   7  
  response.write   "日期型"  
  case   203  
  response.write   "备注型"  
  case   6  
  response.write   "货币型"  
  case   11  
  response.write   "布尔型"  
  end   select  
  response.write   "</td></tr>"  
  end   if  
  next  
  %>  
  </table>  
  <form   method="POST"   action="addfield.asp"   name="myform"   onsubmit="javascript:return   check()">  
      <input   type="hidden"   name="zhiliang_aid"   value=<%=zhiliang_aid%>><input   type="hidden"   name="tablename_a"   value=<%=tablename_a%>>  
      <table   border="1"   width="100%"   bordercolorlight="#000000"   cellspacing="0"   cellpadding="4"   bordercolordark="#FFFFFF">  
          <tr>    
              <td>追加字段个数:      
                  <input   name="upcount"   type="text"     class="input1"     value="1"   size="5">  
                  &nbsp;  
                  <input   name="Submit2"   type="button"     class="input1"     onclick="javascript:setid()"   value="设置">  
                  </td>    
          </tr>    
          <tr>      
              <td>    
                      <table   cellspacing=0   bordercolordark=#ffffff   cellpadding=4   width="100%"   align="center"    
  bordercolorlight=#FFA837     border=1>  
                          <tr>  
                              <td   width="40%">字段说明</td>  
                              <td   width="40%">字段名</td>  
                              <td   width="20%">数据类型</td>  
                          </tr>  
                      </table>  
  <div   id="upid">    
  <table   cellspacing=0   bordercolordark=#ffffff   cellpadding=4   width="100%"   align="center"    
  bordercolorlight=#FFA837     border=1>  
                          <tr>    
                              <td   width="40%"><div   align="center">  
                                      <input   name="text1"   type="text"     class="input1"     size="20">  
                                  </div></td>  
                              <td   width="40%"><div   align="center">  
                                      <input   name="texta1"   type="text"     class="input1"     size="20">  
                                  </div></td>  
                              <td   width="20%"><div   align="center">  
                                      <select   name="list1"   size="1"     class="input1"   >  
                                          <option   value="char(50)">文本型</option>  
                                          <option   value="int">数值型</option>  
                                          <option   value="bit">布尔型</option>  
                                          <option   value="date">日期型</option>  
                                          <option   value="money">货币型</option>  
                                          <option   value="text">备注型</option>  
                                      </select>  
                                  </div></td>  
                          </tr>  
                      </table>  
                  </div>  
              </td>    
          </tr>    
          <script   language="javascript">                
      function   setid()                
      {                
      str=<br>;              
      if(!window.myform.upcount.value)                
        window.myform.upcount.value=1;                
        for(i=1;i<=window.myform.upcount.value;i++)                
          {            
              str=str+<table   cellspacing=0   bordercolordark=#ffffff   cellpadding=4   width="100%"   align="center"   bordercolorlight=#FFA837     border=1>;  
              str=str   +   <tr><td   width="40%"   align="center"><input   type="text"   name="text+i+"   value="字段说明文字"     class="input1"   ></td>;              
              str=str   +   <td   width="40%"   align="center"><input   type="text"   name="texta+i+"   value="字段名"     class="input1"   ></td>;  
              str=str   +   <td   width="20%"   align="center"><select   size="1"   name="list+i+"     class="input1"   >;          
              str=str   +   <option   value="char(50)">文本型</option><option   value="int">数值型</option><option   value="bit">布尔型</option><option   value="date">日期型</option><option   value="money">货币型</option><option   value="text">备注型</option></select></td></tr></table>  
              }                
            window.upid.innerHTML=str+<br>;                
            }                
      </script>    
          <tr>      
              <td>      
                  <p   align="center">      
                      <input   name="B1"   type="submit"     class="input1"     value="追加">  
                         
                      <input   name="Submit"   type="button"     class="input1"     onclick="vbscript:history.back(-1)"   value="返回">  
              </td>    
          </tr>    
      </table>                
  </form>                
  </body>                
  </html>

NO.2   作者: chinahaoj

<html>  
  <head>  
  <title>  
  查询窗口  
  </title>  
  <LINK   href="../css/LxoaButs.css"   rel=stylesheet   type=text/css>  
  <LINK   href="../css/lxoa.css"   rel=stylesheet   type=text/css>  
  <style   type=text/css>  
  a:link   {   color:   #000000;   text-decoration:   none}  
  a:visited   {   color:   #808080;   text-decoration:   none}  
  a:hover   {   color:   #FF0000;   text-decoration:   underline}  
  a:active   {   color:   #6699ff;   text-decoration:   underline}  
  </style>  
  </head>  
  <body   topmargin="10"   leftmargin="0">  
  <table   width="100%"   class=table_style   cellspacing="1"   cellpadding="1"   height="92%">  
  <Tbody>  
  <form   name="form2">  
  <tr   height=1   class=son_tr_top   align=center><td   colspan="2">查询窗口  
  </td></tr>  
  <tr   align=center   height=1><td   colspan="2"   class=table_td_style>&nbsp;  
  </td></tr>  
   
  <script   language="JavaScript">  
  var   k   ;  
  var   cap   =   new   Array()   ;  
  var   string_1   =   ""   ;  
        <%接受参数%>  
  k=window.dialogArguments;  
  var   Sub   =   k.split(";");  
  for   (var   i=0;   i<   Sub.length;   i++   )  
  {  
        pp   =   Sub[i].split(",");  
        cap[i*2]   =   pp[1]   ;  
        cap[i*2+1]   =   pp[2]   ;  
        document.write("<tr><td   width=40%   align=right>"+pp[0])   ;  
        <%时间类型的选择拦                                                                         %>        
        if   (pp[2]   ==   3)    
        {    
            document.write("</td><td><input   maxlength=0   type=text   name=TXT_"+pp[1]+"   size=12   value=<%=date%>>")   ;  
            document.write("<img   src=../images/date.gif   onclick   =javascript:SelDateShow(TXT_"+pp[1]   +   ")>")  
        }   else  
        {  
            if   (pp[2]   ==   4)  
            {  
                document.write("</td><td><Select   size=1   name=TXT_"+pp[1]+"   ><option   Selected   value=></option><option   value=0>未开通</option><option   value=1>已开通</option><option   value=2>欠费停用</option></Select>")   ;  
              }   else  
              {  
                document.write("</td><td><input   type=text   name=TXT_"+pp[1]+"   size=12>")   ;  
              }  
        }  
        document.write("</td></tr>")   ;        
        window.returnValue=string_1   ;  
  }  
   
  </script>  
   
  <tr><td   colspan=2   valign=bottom>    
  <table   width="100%"   cellspacing="1"   cellpadding="1"   height="66">  
  <tr   height=22><td   align=right   valign=bottom>  
  <input   type="button"   onclick="javascript:doCX(1);"   value="未缴费">&nbsp;<input   type="button"   onclick="javascript:doCX(2);"   value="已缴费">&nbsp;<input   type="button"   onclick="javascript:doclose();"   value="放弃">&nbsp;  
  </td></tr>  
  </table></td></tr>  
  </form>  
  </Tbody>  
  </table>  
  </body>  
  </html>  
   
  <script   language="JavaScript">  
   
  function   doCX(son)  
  {  
  var   string_1   =   ""   ;  
  var   reture_str   ,str_1   ;  
  for   (var   j=0;   j<   Sub.length;   j++   )  
  {  
      str_1   =   document.getElementById("TXT_"+   cap[j*2]).value   ;  
      str_1   =   str_1.replace("   ","")  
      if   (str_1   !=   ""   )  
      {  
            if   (   cap[j*2+1]   ==   1   )     {   string_1   =   string_1   +   "   and     "     +   cap[j*2]   +   "   like   %"   +   str_1   +   "%   "       }   ;  
            if   (   cap[j*2+1]   ==   2   )       {   string_1   =   string_1   +   "   and     "     +   cap[j*2]   +   "   =   "   +   str_1   +   "   "       }   ;  
            if   (   cap[j*2+1]   ==   3   )     {    
            if   (son   ==   1   )  
            {  
                string_1   =   string_1   +   "   and     TO_DATE("     +   str_1   +   ",yyyy-mm-dd     hh24:mi:ss)   >   "   +   cap[j*2]   +   "   "        
            }   else  
            {  
                string_1   =   string_1   +   "   and     TO_DATE("     +   str_1   +   ",yyyy-mm-dd     hh24:mi:ss)   <   "   +   cap[j*2]   +   "   "                  
            }  
            }   ;  
            if   (   cap[j*2+1]   ==   4   )       {   string_1   =   string_1   +   "   and     "     +   cap[j*2]   +   "   =   "   +   str_1   +   "   "       }   ;  
      }  
  }  
  reture_str   =   string_1.substring(4,string_1.length)   ;  
  window.returnValue   =   reture_str;  
  window.close();  
  }  
   
  function   doclose()  
  {  
  var   string_1   =   ""   ;  
  window.returnValue=string_1   ;  
  window.close();  
  }  
   
  function   SelDateShow(TXT_name)  
  {  
  var   string1   ,s   ;  
  string1   =   showModalDialog("../publice/P_SelectDataShow.asp",s,"dialogWidth:220px;status:no;scroll:no;dialogHeight:220px");  
  if   (string1!=null)  
      {  
      document.getElementById(TXT_name).value   =   string1.S_SelDate;  
      }  
  }  
  </script>

NO.3   作者: denghan

动态生成的文本框:  
  <form   name="photolist">  
  <%   for   inpageNO=1   to   5   %>  
  <INPUT   class="photoinput"   maxLength=8   size=8   value=1   name=quantity<%=inpageNO%>   onChange="calculate(<%=inpageNO%>);">  
  <%   next   %>  
  </form>  
  它的onchang事件调用的函数中传的参数,就是这个文本框的序号  
   
  <script   language="javascript">  
  //传入的文本框的序号参数  
  function   calculate(i)  
  {  
    var   quantity,  
    //取得由规格列表得到的选项的“照片数量”  
    eval("quantity=document.photolist.quantity"+i+".value;")  
    alert(quantity);  
  }  
  </script>


    摘要: 他的执行太慢了!甚至会弄死iis,为什么? <% dim person_count dim person_name dim person_duty dim person_id dim sql person_count=request.form("upcount") set connect1=server.createobject("adodb.conne......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE