日期:2014-05-17 浏览次数:20517 次
<!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 runat="server"> <title></title> <script type="text/javascript"> function show() { var a = document.getElementById("mytb").rows[0].cells[0].innerText; alert(a);//能输出‘正常’ if (a == "正常") { alert("相等");//没有执行这里 } } </script> </head> <body> <form id="form1" runat="server"> <div> <input id="Button1" type="button" value="button" onclick="show()"/> <table style="width: 100%;" id="mytb"> <tr> <td> 正常</td> <td> 111</td> <td> ddd</td> </tr> <tr> <td> 不正常</td> <td> 444</td> <td> 5555</td> </tr> <tr> <td> 正常</td> <td> 534</td> <td> 53453</td> </tr> </table> </div> </form> </body> </html>