javascript onclick代码更改

时间:2013-12-30 11:30:39

标签: javascript html twitter-bootstrap

为样式表转换器获取此代码

我想要更改它,以便它在我的引导下拉按钮中工作。目前的代码在

之下

<form id="switchform">
<input type="radio" name="choice" value="none" onClick="chooseStyle(this.value, 60)">Default style<br />
<input type="radio" name="choice" value="blue-theme" onClick="chooseStyle(this.value, 60)">Blue Theme<br />
<input type="radio" name="choice" value="brown-theme" onClick="chooseStyle(this.value, 60)">Brown Theme
</form>

我想将它添加到我的bootstrap下拉按钮。目前的代码在

之下
<!-- Split button -->
<div class="btn-group">
  <button type="button" class="btn btn-danger">Action</button>
  <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
    <span class="sr-only">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li><a href="#">Separated link</a></li>
  </ul>
</div>

1 个答案:

答案 0 :(得分:0)

请尝试以下代码:

<!-- demo code -->
<div class="btn-group">
  <button type="button" class="btn btn-danger">Theme Selection</button>
  <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
    <span class="sr-only">Toggle Dropdown</span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li><a href="#" onclick="chooseStyle('none', 60);return false">None</a></li>
    <li><a href="#" onclick="chooseStyle('blue-theme', 60); return false">Blue Theme</a></li>
    <li><a href="#" onclick="chooseStyle('brown-theme', 60); return false">Brown Theme</a></li>
  </ul>
</div>