js动态添加table的行

< %@LANGUAGE = " VBSCRIPT "  CODEPAGE = " 936 " % >
< ! -- #include file = " inc/conn.asp " -->
< %
if  session( " uid " ) = ""   then
response.redirect 
" log_login.asp "
end   if

set  rs = server.createobject( " adodb.recordset " )
sql
= " select * from log_base where uid=' " & session( " uid " ) & " ' and DateDiff('d',now,logdate)=0 "

rs.open sql,conn,
1 , 3

if   not  rs.eof  then
response.write
" <SCRIPT language=JavaScript> "
' response.write"alert('您已添加过今天的工作日志!');"
session( " logid " ) = rs( " logid " )
response.write
" location.href='log_list.asp'</SCRIPT> "
response.end
end   if

rs.close
set  rs = nothing
%
>
< %
logip 
=  Request.ServerVariables( " HTTP_X_FORWARDED_FOR "
If  logip  =   ""   Then  logip  =  Request.ServerVariables( " REMOTE_ADDR " )
%
>
< head >
< meta http - equiv = " Content-Type "  content = " text/html; charset=gb2312 "   />
< title >< % = title% ></ title >
< script type = " text/javascript " >
    var i
= 0 ;
    var j
= 0 ;
      var all 
=  document.getElementsByTagName( " * " ) ;
    
function  numjia()
    {
      i
++ ;
      var tr0
= all.xw.insertRow();
      var td0
= tr0.insertCell( 0 );
          td0.innerHTML
= "" ;
        td0.style.height
= " 10px " ;
      
// tr0.insertCell( 0 ).innerHTML = " &nbsp; " ;
      tr0.insertCell(
1 ).innerHTML = "" ;
      
      var tr
= all.xw.insertRow();
      var td
= tr.insertCell( 0 );
      td.innerHTML
= " 拜访单位: " ;
      td.style.textAlign
= " right " ;
      tr.insertCell(
1 ).innerHTML = " <input name=\ " copname " +i+ " \ "  type=\ " text \ "   size=\ " 45 \ "  class=\ " form \ "  />&nbsp;&nbsp;&nbsp;&nbsp;拜访时间:<select name=\ " ctime " +i+ " \ "  class=\ " form \ "  /><option value=\ " 上午 \ " >上午</option><option value=\ " 下午 \ " >下午</option></select> " ;
      
      var tr1
= all.xw.insertRow();
      tr1.insertCell(
0 ).innerHTML = "" ;
      var tablestr
= " <table width=\ " 100 % \ "  border=\ " 0 \ "  align=\ " center \ "  cellpadding=\ " 1 \ "  cellspacing=\ " 0 \ "  class=\ " gr2 \ " ><tr><td align=\ " center \ " >客户姓名</td><td align=\ " center \ " >职务</td><td align=\ " center \ " >联系方式</td><td align=\ " center \ " >目的</td></tr> "
      
for  (var a = 0 ;a < 4 ;a ++ )
      {
          tablestr
= tablestr + " <tr><td height=\ " 25 \ "  align=\ " center \ " ><input name=\ " cname " +i+a+ " \ "  type=\ " text \ "  class=\ " form \ "  /></td><td align=\ " center \ " ><input name=\ " cduty " +i+a+ " \ "  type=\ " text \ "  class=\ " form \ " /></td><td align=\ " center \ " ><input name=\ " ccon " +i+a+ " \ "  type=\ " text \ "  class=\ " form \ "  /></td><td align=\ " center \ " ><select name=\ " cpop " +i+a+ " \ " ><option value=\ " 初次拜访 \ " >初次拜访</option><option value=\ " 例行拜访 \ " >例行拜访</option><option value=\ " 意向跟踪 \ " >意向跟踪</option><option value=\ " 样品跟踪 \ " >样品跟踪</option><option value=\ " 签约合同 \ " >签约合同</option><option value=\ " 送货 \ " >送货</option><option value=\ " 验货 \ " >验货</option><option value=\ " 开票 \ " >开票</option><option value=\ " 催款 \ " >催款</option><option value=\ " 招投标 \ " >招投标</option><option value=\ " 产品演示 \ " >产品演示</option></select></td></tr> "
      }
      tablestr
= tablestr + " </table> "
      tr1.insertCell(
1 ).innerHTML = tablestr
      
      var tr2
= all.xw.insertRow();
      var td2
= tr2.insertCell( 0 );
      td2.innerHTML
= " 拜访内容: " ;
      td2.style.textAlign
= " right " ;
      tr2.insertCell(
1 ).innerHTML = " <textarea name=\ " logcour " +i+ " \ "  cols=\ " 80 \ "  rows=\ " 6 \ "  type=\ " text \ "  class=\ " form \ " ></textarea> " ;
      
      var tr2a
= all.xw.insertRow();
      var td2a
= tr2a.insertCell( 0 );
      td2a.innerHTML
= " 客户单位意向情况: " ;
      td2a.style.textAlign
= " right " ;
      tr2a.insertCell(
1 ).innerHTML = " <textarea name=\ " mudi " +i+ " \ "  cols=\ " 80 \ "  rows=\ " 6 \ "  type=\ " text \ "  class=\ " form \ " ></textarea> " ;
      
      var tr3
= all.xw.insertRow();
      tr3.insertCell(
0 ).innerHTML = " &nbsp; " ;
      tr3.insertCell(
1 ).innerHTML = " &nbsp; " ;
      
      document.getElementById(
" ccount " ).value =++ document.getElementById( " ccount " ).value;
    }
</ script >
< link href = " css/style.css "  rel = " stylesheet "  type = " text/css " >
</ head >
< body >
< table width = " 98% "  height = " 40 "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 " >
           
< tr >
          
< td valign = " bottom " >< img src = " images/title_log.gif "  width = " 82 "  height = " 18 " ></ td >
        
</ tr >
      
</ table >
< table width = " 98% "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 " >
        
< tr >
          
< td height = " 10 " ></ td >
        
</ tr >
      
</ table >
      
< table width = " 98% "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 "  class = " gr1 " >
         
< form method = " POST "  action = " log_search.asp " >
        
< tr >
          
< td height = " 30 "  align = " center " > 日志查询(请选择日期): < select  name = " logyear "  id = " logyear "  class = " s " >
          
< option  value = "" > 请选择 </ option >
          
< option  value = " 2006 " > 2006 </ option >
          
< option  value = " 2007 " > 2007 </ option >
          
< option  value = " 2008 " > 2008 </ option >
          
< option  value = " 2009 " > 2009 </ option >
          
< option  value = " 2010 " > 2010 </ option >
          
< option  value = " 2011 " > 2011 </ option >
          
< option  value = " 2012 " > 2012 </ option >
          
< option  value = " 2013 " > 2013 </ option >
          
< option  value = " 2014 " > 2014 </ option >
          
< option  value = " 2015 " > 2015 </ option >
          
< option  value = " 2016 " > 2016 </ option >
          
< option  value = " 2017 " > 2017 </ option >
          
< option  value = " 2018 " > 2018 </ option >
          
< option  value = " 2019 " > 2019 </ option >
          
< option  value = " 2020 " > 2020 </ option >
          
< option  value = " 2021 " > 2021 </ option >
          
< option  value = " 2022 " > 2022 </ option >
          
< option  value = " 2023 " > 2023 </ option >
          
< option  value = " 2024 " > 2024 </ option >
          
< option  value = " 2025 " > 2025 </ option >
        
</ select >
         年  
         
< select  name = " logmonth "  id = " logmonth "  class = " s " >
           
< option  value = "" > 请选择 </ option >
           
< option > 12 </ option >
           
< option > 11 </ option >
           
< option > 10 </ option >
           
< option > 09 </ option >
           
< option > 08 </ option >
           
< option > 07 </ option >
           
< option > 06 </ option >
           
< option > 05 </ option >
           
< option > 04 </ option >
           
< option > 03 </ option >
           
< option > 02 </ option >
           
< option > 01 </ option >
          
</ select >
          月
< font color = " #ff6600 " > (年份、月份必选) & nbsp; & nbsp;
          
< input type = " submit "  value = " 查 询 "  class = " btn " ></ font ></ td >  
        
</ tr >
        
</ form >
      
</ table >
< table width = " 98% "  border = " 0 "  align = " center "  cellpadding = " 0 "  cellspacing = " 0 " >
        
< tr >
          
< td height = " 10 " ></ td >
        
</ tr >
      
</ table >
      
< form method = " POST "  action = " log_save.asp?page=log_add.asp " >
< %
logyear
= year ( date ())
logmonth
= month ( date ())
%
>
< input name = " logip "  type = " hidden "  class = " form "  value = " <%=logip%> " >
< input name = " logyear "  type = " hidden "  class = " form "  value = " <%=logyear%> " >
< input name = " logmonth "  type = " hidden "  class = " form "  value = " <%=logmonth%> " >
< table width = " 98% "  boder = " 0 "  cellspacing = " 0 "  cellpadding = " 0 "  align = " center "  class = " gr3 " >
  
< tr height = " 30 " >  
    
< td width = " 19% " > 日期: < % = date ()% >< input name = " logdate "  type = " hidden "  value = " <%=date()%> " ></ td >
    
< td width = " 33% " > 工作地点: < input name = " logadd "  type = " txt "  class = " form "  size = " 25 " >& nbsp; < font color = " #FF6600 " >*</ font ></ td >
    
< td width = " 44% " > 填表人: < % = session( " uid " )% >< input name = " uid "  type = " hidden "  value = " <%=session( " uid " )%> " >< input type = " hidden "  name = " logid "  value = "" ></ td >
  
</ tr >
</ table >
< table width = " 98% "  boder = " 0 "  cellspacing = " 0 "  cellpadding = " 0 "  align = " center "  class = " gr1 " >
  
< tr >
    
< td class = " gr2 "  height = " 30 "  align = " right "  width = " 220 " > 今日拜访客户数: </ td >
    
< td class = " gr2 " >< input name = " ccount "  type = " txt "  class = " form "  size = " 10 "  value = " 0 " >& nbsp;家 & nbsp; < font color = " #FF6600 " >*</ font >< ! --< span style = " cursor:pointer;color:red; "  onClick = " numjia() " >& nbsp; & nbsp;添加 </ span >--></ td >
  
</ tr >
  
< tr >
    
< td width = " 220 "  align = " right "  class = " gr2 " > 本日工作总结: </ td >
    
< td class = " gr2 " >< textarea name = " logwill "  cols = " 80 "  rows = " 5 "  type = " txt "  class = " form " ></ textarea >& nbsp; < font color = " #FF6600 " >*</ font ></ td >
  
</ tr >
  
< tr >
    
< td height = " 5 "  colspan = " 2 " ></ td >
  
</ tr >
  
< ! --< tr >
    
< td class = " gr2 "  align = " right " > 本日工作总结: </ td >
    
< td class = " gr2 "  colspan = " 5 " >< textarea name = " loglog "  cols = " 60 "  rows = " 5 "  type = " txt "  class = " form " ></ textarea >& nbsp; < font color = " #FF6600 " >*</ font ></ td >
  
</ tr >-->
  
< tr id = " df " >< td colspan = " 2 " >
      
< table width = " 100% "  border = " 0 "  cellpadding = " 0 "  cellspacing = " 0 "  class = " gr2 "  id = " xw " >
      
</ table >
  
</ td ></ tr >
  
< tr >
    
< td height = " 5 "  colspan = " 2 " ></ td >
  
</ tr >
  
  
< tr >          
    
< td align = " center "  height = " 32 "  colspan = " 2 " >< input type = " submit "  value = "  提交 "  class = " btn " >< b >& nbsp;  </ b >< input type = " reset "  value = "  重置 "  class = " btn " ></ td >          
  
</ tr >
</ table >
</ form >
< script > numjia() </ script >
</ body >
</ html >

你可能感兴趣的:(table)