在程序中有时候我们需要根据选择来显示我们需要的信息,通过控制table中row的显示可以实现这样的功能.
None Row1 Row2 Row3
Row1
Row2
Row3
JavaScript

function changeRow(id, status)
{
document.getElementById("Row1").style.display ="none";
document.getElementById("Row2").style.display ="none";
document.getElementById("Row3").style.display ="none";
var elm = document.getElementById("Row"+id);
if (!elm)
return false;

elm.style.display = (status == true) ? "" : "none";
}

HTML

|
|

