简单的JavaScript显示和隐藏元素
// show or hide a selected element // if no state is given, the visibility is toggled // otherwise visibility is set to hidden or visible as selected function showHide(e, state) { el = document.getElementById(e); if (state == "hidden") { el.style.visibility = "hidden"; } else if (state == "visible") { el.style.visibility = "visible"; } else { el.style.visibility = el.style.visibility == "visible" ? "hidden" : "visible"; } }