<table class="filetable" id="filetable">
<thead>
<tr>
<th width="25%">名称</th>
<th width="6%">大小</th>
<th width="10%">类型</th>
<th width="19%">修改日期</th>
<th width="40%"></th>
</tr>
</thead>
<tbody id="FileList" runat="server">
<tr>
<td><img src="images/f01.png" />Adobe Dreamweaver CS5简体中文绿色</td>
<td>2013/10/14 17:38</td>
<td>文件夹</td>
<td class="tdlast">0 KB</td>
<td></td>
</tr>
</tbody>
</table>
this is a table, I want to get the value of each FileName when double click coresponding item.
I write script as follow:
<script>
function Test() {
var rows = document.getElementById("filetable").rows;
if (rows.length > 0) {
for (var i = 1; i < rows.length; i++) {
(function (i) {
var temp = rows[i].cells[0].childNodes[1];
var obj = rows[i];
obj.ondblclick = function () { alert(temp); };
})(i)
}
}
}
window.onload = function () { Test(); }
</script>
the output of alert is [object Text].
So , how can I get the value instead of type