CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

客户端读取datagrid单元格数据(编辑状态)的问题?

楼主lgd1974(东东)2005-02-24 08:39:44 在 Web 开发 / JavaScript 提问

如题  
  具体情况:  
  客户端显示的代码:  
  <td><input   name="GridWDZL:_ctl3:_ctl0"   type="text"   style="background-color:PowderBlue;border-style:None;width:100%;"   /></td>  
  该单元格的innerHTML:  
  Row.cells[3].innerHTML  
  "<INPUT   style=\"WIDTH:   100%;   BORDER-TOP-STYLE:   none;   BORDER-RIGHT-STYLE:   none;   BORDER-LEFT-STYLE:   none;   BACKGROUND-COLOR:   powderblue;   BORDER-BOTTOM-STYLE:   none\"   value=可靠的   name=GridWDZL:_ctl3:_ctl0>"  
   
  如何把value的值读到?  
  问题点数:20、回复次数:8Top

1 楼vivianfdlpw()回复于 2005-02-24 09:09:08 得分 20

到底是哪个input?Top

2 楼lgd1974(东东)回复于 2005-02-24 09:18:10 得分 0

上面的是客户端源文件中显示的内容。  
   
  下面的是在javascript中可以得到的数据-》Row.cells[3].innerHTML  
  Top

3 楼vivianfdlpw()回复于 2005-02-24 09:39:13 得分 0

读取name为GridWDZL:_ctl3:_ctl0的文本框的值:  
  function   get()  
  {  
  var   s=document.getElementsByName   ('GridWDZL:_ctl3:_ctl0')[0];  
  if(s==null||typeof(s)=='undefined')  
  {  
      alert('找不到元素');  
  }  
  else  
  {  
      alert(s.value)  
  }  
  }Top

4 楼lgd1974(东东)回复于 2005-02-24 10:07:20 得分 0

to   vivianfdlpw()    
  document.getElementsByName   ('GridWDZL:_ctl3:_ctl0')[0]的值为undefined  
  在document.getElementsByName   ('GridWDZL:_ctl3:_ctl0').outerHTML中有我要的value值Top

5 楼vivianfdlpw()回复于 2005-02-24 10:08:33 得分 0

能把全部代码贴出来吗?Top

6 楼lgd1974(东东)回复于 2005-02-24 10:21:20 得分 0

太多了  
  <TD   id="TDGridWDZL"   valign="top"   width="100%"   colspan="8"   height="100%"><table   cellspacing="0"   rules="all"   border="1"   id="GridWDZL"   style="height:200px;width:100%;border-collapse:collapse;position:none;WORD-BREAK:break-all;WORD-WRAP:break-word;TABLE-LAYOUT:fixed;"><thead>  
  <tr   class="tablehead"   style="height:22px;">  
  <td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:10%;">序号</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:0px;">BZGXWDID</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:0px;">BZJXGXID</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:40%;">文档名称</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:20%;">文档类型</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:10%;">编写人</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:20%;">提交时间</td>  
  </tr></thead><tbody><tr   class="tablebody"   onclick="javascript:return   select(this,'0','WDZL');"   ondblclick="__doPostBack('GridWDZL:_ctl3','Edit')"   style="height:22px;">  
  =====================================这里了= <td>1</td><td>cbcdd896fc854c2494110c1814aced2b</td><td>25023C58BCA04DC9AA2D8B06AB59D165</td><td><input   name="GridWDZL:_ctl3:_ctl0"   type="text"   style="background-color:PowderBlue;border-style:None;width:100%;"   /></td><td>image/pjpeg</td><td><input   name="GridWDZL:_ctl3:_ctl1"   type="text"   style="background-color:PowderBlue;border-style:None;width:100%;"   /></td><td><input   name="GridWDZL:_ctl3:_ctl2"   type="text"   value="2005-2-14   0:00:00"   onclick="setday(this,this,'yyyy-mm-dd')"   style="background-color:PowderBlue;border-style:None;width:100%;"   /></td>  
  ======================================  
  </tr><tr   class="tablebody2"   onclick="javascript:return   select(this,'1','WDZL');"   ondblclick="__doPostBack('GridWDZL:_ctl4','Edit')"   style="height:22px;">  
  <td>2</td><td>c768a32f544444f894d7ca4c8bedab31</td><td>25023C58BCA04DC9AA2D8B06AB59D165</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  
  </tr><tr   align="Center"   valign="Middle"   style="font-size:9pt;height:22px;">  
  <td   colspan="7"   style="height:23px;"><a   id="GridWDZL__ctl6_lbFirst"   disabled="disabled">首页</a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbPrve"   disabled="disabled">上一页</a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbNext"   disabled="disabled">下一页</a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbLast"   disabled="disabled">末页</a>&nbsp;&nbsp;<span   id="GridWDZL__ctl6_lblCurPage">【第1页</span><span   id="GridWDZL__ctl6_lblPageCount">/共1页】</span>&nbsp;<span   id="GridWDZL__ctl6_lblRowCount">【共2条】</span>&nbsp;&nbsp;<input   name="GridWDZL:_ctl6:tbGoPage"   type="text"   id="GridWDZL__ctl6_tbGoPage"   disabled="disabled"   style="font-family:宋体;font-size:9pt;height:20px;width:40px;"   />&nbsp;&nbsp;<input   type="submit"   name="GridWDZL:_ctl6:btnGo"   value="转到"   id="GridWDZL__ctl6_btnGo"   disabled="disabled"   style="font-family:宋体;font-size:9pt;height:22px;width:40px;"   />&nbsp;&nbsp;</td>  
  </tr>  
  <tr   style='height:auto;'><td   colspan=7   style='BORDER-BOTTOM:   thin   solid'></td></tr></tbody><tfoot></tfoot></table><script   language=javascript>function   DG_moveOnTH(td)  
  {  
  if(event.offsetX   >   td.offsetWidth   -   6   ||   event.offsetX   <   6)  
  td.style.cursor   =   'w-resize';  
  else  
  td.style.cursor   =   'default';  
   
  if(td.mouseDown==true)  
  {  
  if   (event.offsetX   <   6)  
  {  
  td2   =   td.previousSibling;  
  offset   =   event.x   -   td2.oldX;  
  td2.width   =   td2.oldWidth   +   offset;  
  td2.style.width   =   td2.width;                  
  table=td;  
  while(table.tagName   !=   'TABLE')   {table   =   table.parentElement;}  
  table.width   =   td2.tableWidth+offset;  
  table.style.width   =   table.width;  
  }  
  else  
  {  
  offset   =   event.x   -   td.oldX;  
  td.width   =   td.oldWidth   +   offset;  
  td.style.width   =   td.width;  
  td.style.cursor   =   'w-resize';  
  table=td;  
  while(table.tagName   !=   'TABLE')   table   =   table.parentElement;  
  table.width   =   td.tableWidth+offset;  
  table.style.width   =   table.width;  
  }  
  }  
  }  
  function   DG_downOnTH(td)  
  {  
  if(event.offsetX   >   td.offsetWidth   -   6)  
  {  
  td.mouseDown   =   true;  
  td.oldX   =   event.x;  
  td.oldWidth   =   td.offsetWidth;  
  table   =   td;  
  while(table.tagName   !=   'TABLE')   table   =   table.parentElement;  
  td.tableWidth   =   table.offsetWidth;  
  }  
  else   if(event.offsetX   <   6)  
  {  
  td2   =   td.previousSibling;  
  td.mouseDown   =   true;  
  td2.oldX   =   event.x;  
  td2.oldWidth   =   td2.offsetWidth;  
  table   =   td2;  
  while(table.tagName   !=   'TABLE')   table   =   table.parentElement;  
  td2.tableWidth   =   table.offsetWidth;  
  }  
  else  
  td.mouseDown   =   false;  
  }</script></TD>Top

7 楼lgd1974(东东)回复于 2005-02-24 10:52:02 得分 0

已经解决了Top

8 楼vivianfdlpw()回复于 2005-02-24 10:52:07 得分 0

下面的代码测试可以的:  
   
  <style>  
  input{t:expression(this.ondblclick=function(){get()})}  
  </style>  
  <table><tr>  
  <TD   id="TDGridWDZL"   valign="top"   width="100%"   colspan="8"   height="100%"><table    
   
  cellspacing="0"   rules="all"   border="1"   id="GridWDZL"   style="height:200px;width:100%;border-  
   
  collapse:collapse;position:none;WORD-BREAK:break-all;WORD-WRAP:break-word;TABLE-  
   
  LAYOUT:fixed;"><thead>  
  <tr   class="tablehead"   style="height:22px;">  
  <td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:10%;">序号  
   
  </td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"    
   
  style="width:0px;">BZGXWDID</td><td   onmousemove="DG_moveOnTH(this)"    
   
  onmousedown="DG_downOnTH(this)"   onmouseup="this.mouseDown=false"    
   
  onmouseout="this.mouseDown=false"   style="width:0px;">BZJXGXID</td><td    
   
  onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:40%;">文档名  
   
  称</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:20%;">文档类  
   
  型</td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:10%;">编写人  
   
  </td><td   onmousemove="DG_moveOnTH(this)"   onmousedown="DG_downOnTH(this)"    
   
  onmouseup="this.mouseDown=false"   onmouseout="this.mouseDown=false"   style="width:20%;">提交时  
   
  间</td>  
  </tr></thead><tbody><tr   class="tablebody"   onclick="javascript:return   select  
   
  (this,'0','WDZL');"   ondblclick="__doPostBack('GridWDZL:_ctl3','Edit')"   style="height:22px;">  
  <td>1</td><td>cbcdd896fc854c2494110c1814aced2b</td><td>25023C58BCA04DC9AA2D8B06AB59D165</td>  
   
  <td><input   name="GridWDZL:_ctl3:_ctl0"   type="text"   style="background-  
   
  color:PowderBlue;border-style:None;width:100%;"   /></td><td>image/pjpeg</td><td><input    
   
  name="GridWDZL:_ctl3:_ctl1"   type="text"   style="background-color:PowderBlue;border-  
   
  style:None;width:100%;"   /></td><td><input   name="GridWDZL:_ctl3:_ctl2"   type="text"    
   
  value="2005-2-14   0:00:00"   onclick="setday(this,this,'yyyy-mm-dd')"   style="background-  
   
  color:PowderBlue;border-style:None;width:100%;"   /></td>  
  ======================================  
  </tr><tr   class="tablebody2"   onclick="javascript:return   select(this,'1','WDZL');"    
   
  ondblclick="__doPostBack('GridWDZL:_ctl4','Edit')"   style="height:22px;">  
   
   
  <td>2</td><td>c768a32f544444f894d7ca4c8bedab31</td><td>25023C58BCA04DC9AA2D8B06AB59D165</td>  
   
  <td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>  
  </tr><tr   align="Center"   valign="Middle"   style="font-size:9pt;height:22px;">  
  <td   colspan="7"   style="height:23px;"><a   id="GridWDZL__ctl6_lbFirst"    
   
  disabled="disabled">首页</a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbPrve"   disabled="disabled">上  
   
  一页</a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbNext"   disabled="disabled">下一页  
   
  </a>&nbsp;&nbsp;<a   id="GridWDZL__ctl6_lbLast"   disabled="disabled">末页</a>&nbsp;&nbsp;<span    
   
  id="GridWDZL__ctl6_lblCurPage">【第1页</span><span   id="GridWDZL__ctl6_lblPageCount">/共1页】  
   
  </span>&nbsp;<span   id="GridWDZL__ctl6_lblRowCount">【共2条】</span>&nbsp;&nbsp;<input    
   
  name="GridWDZL:_ctl6:tbGoPage"   type="text"   id="GridWDZL__ctl6_tbGoPage"   disabled="disabled"    
   
  style="font-family:宋体;font-size:9pt;height:20px;width:40px;"   />&nbsp;&nbsp;<input    
   
  type="submit"   name="GridWDZL:_ctl6:btnGo"   value="转到"   id="GridWDZL__ctl6_btnGo"    
   
  disabled="disabled"   style="font-family:宋体;font-size:9pt;height:22px;width:40px;"    
   
  />&nbsp;&nbsp;</td>  
  </tr>  
  <tr   style='height:auto;'><td   colspan=7   style='BORDER-BOTTOM:   thin    
   
  solid'></td></tr></tbody><tfoot></tfoot></table><script   language=javascript>function    
   
  DG_moveOnTH(td)  
  {  
  if(event.offsetX   >   td.offsetWidth   -   6   ||    
   
  event.offsetX   <   6)  
  td.style.cursor   =   'w-resize';  
  else  
  td.style.cursor   =   'default';  
   
  if(td.mouseDown==true)  
  {  
  if   (event.offsetX   <   6)  
  {  
  td2   =   td.previousSibling;  
  offset   =   event.x   -   td2.oldX;  
  td2.width   =   td2.oldWidth   +   offset;  
  td2.style.width   =   td2.width;            
   
         
  table=td;  
  while(table.tagName   !=   'TABLE')    
   
  {table   =   table.parentElement;}  
  table.width   =   td2.tableWidth+offset;  
  table.style.width   =   table.width;  
  }  
  else  
  {  
  offset   =   event.x   -   td.oldX;  
  td.width   =   td.oldWidth   +   offset;  
  td.style.width   =   td.width;  
  td.style.cursor   =   'w-resize';  
  table=td;  
  while(table.tagName   !=   'TABLE')    
   
  table   =   table.parentElement;  
  table.width   =   td.tableWidth+offset;  
  table.style.width   =   table.width;  
  }  
  }  
  }  
  function   DG_downOnTH(td)  
  {  
  if(event.offsetX   >   td.offsetWidth   -   6)  
  {  
  td.mouseDown   =   true;  
  td.oldX   =   event.x;  
  td.oldWidth   =   td.offsetWidth;  
  table   =   td;  
  while(table.tagName   !=   'TABLE')   table   =    
   
  table.parentElement;  
  td.tableWidth   =   table.offsetWidth;  
  }  
  else   if(event.offsetX   <   6)  
  {  
  td2   =   td.previousSibling;  
  td.mouseDown   =   true;  
  td2.oldX   =   event.x;  
  td2.oldWidth   =   td2.offsetWidth;  
  table   =   td2;  
  while(table.tagName   !=   'TABLE')   table   =    
   
  table.parentElement;  
  td2.tableWidth   =   table.offsetWidth;  
  }  
  else  
  td.mouseDown   =   false;  
  }</script></TD></tr></table>  
  <script>  
  function   get()  
  {  
  var   s=document.getElementsByName   ('GridWDZL:_ctl3:_ctl0')[0];  
  if(s==null||typeof(s)=='undefined')  
  {  
      alert('找不到元素');  
  }  
  else  
  {  
      alert(s.value)  
  }  
  }  
   
  </script>Top

相关问题

  • 客户端读取datagrid单元格数据(编辑状态)的问题?
  • 读取datagrid单元格中的值?
  • 用C#如何合并excel的单元格及读取被合并了的单元格的数据?
  • ★★★★★奇怪的问题无法读取Excel单元格中的数据★★★★★
  • 请教,如何用asp读取excel表中的单元格数据?
  • 如何用java读取excel2003的单元格的数据?着急啊~~~~~~~
  • 如何修改datagrid单元格中的数据呢??
  • 怎样在dataGrid的单元格中写数据?
  • 怎样选择datagrid中单元格中的数据,用命令?
  • 用C#读取Excel文件:怎样从指定单元格开始向右向下读取数据?

关键词

  • 文档
  • 客户
  • dc
  • document
  • gridwdzl
  • ctl
  • b06ab59d165
  • 客户端
  • bca04dc9aa2d8
  • getelementsbyname

得分解答快速导航

  • 帖主:lgd1974
  • vivianfdlpw

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo