首页 > 代码库 > js按钮(bootstrap)超链接

js按钮(bootstrap)超链接

html代码:

button是bootstrap样式,请先加入bootstrap.min.css和jquery-1.11.1.min.js

1 <a href=http://www.mamicode.com/"#" id="DownLoadAudio" target="_blank"></a>2 <button id="Submit6" class="btn btn-sm btn-success" type="button" onclick="openWin(@item.UserID,@item.AudioID)">3 <i class="glyphicon glyphicon-download-alt"></i>下载</button>

javascript代码:

1 <script type="text/javascript">2     function openWin(userid, audioid) {3                 var obj = document.getElementById("DownLoadAudio");4                 obj.href =http://www.mamicode.com/ data.state;5                 obj.click();6             }7</script>

 

js按钮(bootstrap)超链接