var p=document.all("val"); //声明一个变量 p.style.display=p.style.display=="none"?"":"none"; <tr id="val"> </tr>