js双击获取<td></td>里面的内容
js双击获取<td></td>里面的内容
<td width="10%" class="table_td_bg">Hello Word!</td>
[解决办法]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title></title> <script language="javascript"> function showText(obj) { var text = obj.innerText ? obj.innerText : //ie等浏览器支持的属性 obj.textContent; //FF支持的属性,取得到值为“\n hello,” alert(text); } </script></head><body><table><tr > <td ondblclick="showText(this);"><p>hello,</p></td> <td>world</td></tr></table></body></html>