使用JS+CSS實現點擊選項按鈕顯示相應菜單

來源:互聯網
上載者:User
<html><head><title>網上書店</title><script language="JavaScript">function fsubmit() {if (searchForm.rcond[0].checked) {searchForm.action = "list?cond=all";} else if (searchForm.rcond[1].checked) {searchForm.action = "list?cond=precision";} else {searchForm.action="list?cond=keyword"}}function hideall() {if (searchForm.rcond[0].checked) {pre.style.display = "none";key.style.display = "none";}}function showpre() {if (searchForm.rcond[1].checked) {pre.style.display = "";key.style.display = "none";} else {pre.style.display = "none";}}function showkey() {if (searchForm.rcond[2].checked) {key.style.display = "";pre.style.display = "none";} else {key.style.display = "none";}}</script></head><body><form name="searchForm" action="" method="post" onClick="fsubmit()"><input type="radio" name="rcond" onclick="hideall()" checked/>查看所有圖書<br/><input type="radio" name="rcond" onclick="showpre()"/>精確搜尋<br/><table id="pre" style="display: none"><tr><td>書名:</td><td><input type="text" name="title"/></td></tr><tr><td>作者:</td><td><input type="text" name="author"/></td></tr><tr><td>出版社:</td><td><input type="text" name="bookconcern"/></td></tr></table><input type="radio" name="rcond" onclick="showkey()"/>關鍵字搜尋<br/><table id="key" style="display: none"><tr><td>請輸入關鍵字:</td><td><input type="text" name="keyword"></td></tr></table><input type="reset" value="重新輸入"/><input type="submit" value="搜尋"/></form></body></html>
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.