<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>按钮状态——禁用状态</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script>
window.onload = function(){
document.getElementById("btn1").onclick = function(){
alert("btn1")}
document.getElementById("btn2").onclick = function(){
alert("btn2")}
}
</script>
</head>
<body>
<button class="btn btn-primary btn-lg btn-block" id="btn1" type="button" disabled="disabled">通过disabled属性禁用按钮</button>
<button class="btn btn-primary btn-block disabled" id="btn2" type="button" >通过添加类名disabled禁用按钮</button>
<button class="btn btn-primary btn-sm btn-block" type="button">未禁用的按钮</button>
</body>
</html>
不是在慕课网上,在本地执行也是这样, 目前的版本两种disabled添加方式应该都会禁用默认行为 ..
你可以在你的本地执行试一下..