日期:2014-05-17 浏览次数:20600 次
<html> <head> <script type="text/javascript"> function getInnerHTML() { //alert(document.getElementById("id1").innerHTML); if(document.getElementById("id1").innerHTML != ""){ alert("true") }else{ alert("false"); } } </script> </head> <body> <table border="1"> <tr id="tr1"> <th>Firstname</th> <th>Lastname</th> </tr> <tr id="tr2"> <td id="id1">Peter</td> <td>Griffin</td> </tr> </table> <br /> <input type="button" onclick="getInnerHTML()" value="Alert innerHTML of table row" /> </body> </html>