我的最终目标是提供一个小的下拉菜单,该菜单在选择其他选项时显示一个按钮!这是我的代码:ps。(我正在使用 twitter 引导程序!)pps。(该按钮打开一个网站链接,但我还没有填写它们!):
<select value="Graphic Design" id="mydemo" class="span3 offset4" tabindex="1" name="theartsierlist">
<option id="already" value="0" selected="selected">Choose An Artsiness</option>
<option id="zero" value="http://www.google.com">Photoshop</option>
<option id="one" value="1">Illustration</option>
<option id="two" value="2">Coding</option>
</select>
<button id="mybutton" onclick="window.open(mydemo.options[mydemo.selectedIndex].value)" class="btn btn-primary btn-large btn-danger">Downloads</button>
<script>
x = document.getElementById("mydemo").options[mydemo.selectedIndex].value
y = document.getElementById("mybutton");
var visible = new function(){
if (document.getElementById("mydemo").options[mydemo.selectedIndex].value == 0) {
y.style.visibility = "hidden";
} else if????
</script>