Re: [問題] 下拉式選單的應用?
※ 引述《sueadolph (人..只剩下不信任)》之銘言:
: 請問這樣子的下拉式選單要怎麼設定?
: 1.甲
: 2.乙
: 3.丙
: 4.其它
: 當選"其它"的時候,右邊會自動出現一個可輸入的框框
以下是簡單的程式碼..依照需求去改吧:D
<html>
<head>
<script type=text/javascript language=javascript>
function showBar()
{
if( document.getElementById('list').value==4 )
document.getElementById('otherbar').style.visibility="visible";
else
document.getElementById('otherbar').style.visibility="hidden";
}
</script>
</head>
<body>
<form>
<select id=list onchange=showBar()>
<option value=1 selected>甲</option>
<option value=2>乙</option>
<option value=3>丙</option>
<option value=4>其他</option>
</select>
<div id=otherbar style="visibility:hidden"><input type=text></div>
</form>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.138.17.45
推
06/13 22:48, , 1F
06/13 22:48, 1F
推
06/14 15:18, , 2F
06/14 15:18, 2F
討論串 (同標題文章)
Web_Design 近期熱門文章
PTT數位生活區 即時熱門文章