作者drlai (苏打)
看板Web_Design
标题Re: [问题] 下拉式选单的应用?
时间Tue Jun 13 10:59:20 2006
※ 引述《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
1F:推 sueadolph:谢谢~ 06/13 22:48
2F:推 litthe:奇怪..连这样的程式码,都会被IE的安全性拦下= = 06/14 15:18