客户端读取datagrid单元格数据(编辑状态)的问题?
如题
具体情况:
客户端显示的代码:
<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> </td><td> </td><td> </td><td> </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> <a id="GridWDZL__ctl6_lbPrve" disabled="disabled">上一页</a> <a id="GridWDZL__ctl6_lbNext" disabled="disabled">下一页</a> <a id="GridWDZL__ctl6_lbLast" disabled="disabled">末页</a> <span id="GridWDZL__ctl6_lblCurPage">【第1页</span><span id="GridWDZL__ctl6_lblPageCount">/共1页】</span> <span id="GridWDZL__ctl6_lblRowCount">【共2条】</span> <input name="GridWDZL:_ctl6:tbGoPage" type="text" id="GridWDZL__ctl6_tbGoPage" disabled="disabled" style="font-family:宋体;font-size:9pt;height:20px;width:40px;" /> <input type="submit" name="GridWDZL:_ctl6:btnGo" value="转到" id="GridWDZL__ctl6_btnGo" disabled="disabled" style="font-family:宋体;font-size:9pt;height:22px;width:40px;" /> </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> </td><td> </td><td> </td><td> </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> <a id="GridWDZL__ctl6_lbPrve" disabled="disabled">上
一页</a> <a id="GridWDZL__ctl6_lbNext" disabled="disabled">下一页
</a> <a id="GridWDZL__ctl6_lbLast" disabled="disabled">末页</a> <span
id="GridWDZL__ctl6_lblCurPage">【第1页</span><span id="GridWDZL__ctl6_lblPageCount">/共1页】
</span> <span id="GridWDZL__ctl6_lblRowCount">【共2条】</span> <input
name="GridWDZL:_ctl6:tbGoPage" type="text" id="GridWDZL__ctl6_tbGoPage" disabled="disabled"
style="font-family:宋体;font-size:9pt;height:20px;width:40px;" /> <input
type="submit" name="GridWDZL:_ctl6:btnGo" value="转到" id="GridWDZL__ctl6_btnGo"
disabled="disabled" style="font-family:宋体;font-size:9pt;height:22px;width:40px;"
/> </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




