日期:2014-05-17 浏览次数:20535 次
onclick="getvalue(this);"
------解决方案--------------------
这个是我测试的。。也传上来给你看看是不是你要的效果。。
<body>
<table>
<tr>
<td>
<img ID="imgSMSid" alt="" src="" onclick="getvalue(this);" runat="server" />
<input type="hidden" name="hddReamrk" id="hfRemark" value='3' runat="server" />
</td>
</tr>
</table>
</body>
</html>
<script type="text/jscript">
function getvalue(o)
{
var img = o;
var SMS = img.parentNode.childNodes.item(2).value;
alert(SMS);
}
</script>
------解决方案--------------------
前台加
<asp:HiddenField ID="Hi_Code" runat="server" />
后台
if (e.Row.RowType == DataControlRowType.DataRow)
{
string code = ((Label)e.Row.FindControl("Label1")).Text; // 需要选中的控件值
e.Row.Attributes.Add("onclick", string.Format("selectx(this);document.getElementById('{0}').value='{1}';", Hi_Code.ClientID, code));
//把每行 加事件.
}
取值的时候 直接 Hi_Code.Value .