步骤
1
:
使用Bootstrap和不用的区别
顶
折
演示按钮 输入框 下拉框等常见的组件,在原生html和Bootstrap的效果比较
同时还演示了几种html中没有的效果
");
window.frames["iframe_show1252"].document.write(decodeHtml($("textarea#stepcodeTextarea1252").val()));
window.frames["iframe_show1252"].document.close();
$(window.frames["iframe_show1252"]).load(function(){
$("#iframe_show1252").height($("#iframe_show1252").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1252").height($("#iframe_show1252").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<!DOCTYPE html>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<table width="200" border="1" class="table table-bordered">
<tr>
<td>HTML</td>
<td>Bootstrap</td>
</tr>
<tr>
<td><button>按钮</button></td>
<td><button class="btn btn-success">按钮</button></td>
</tr>
<tr>
<td><input type="text" value="输入框"></td>
<td><input type="text" value="输入框" class="form-control"></td>
</tr>
<tr>
<td>
<select >
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
</select> </td>
<td>
<select class="form-control">
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
</select> </td>
</tr>
</tr>
<tr>
<td >下拉菜单(传统HTML不提供)</td>
<td>
<div class="dropdown">
<button type="button" class="btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
http://192.168.1.189
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li>
<a href="#">Java基础</a>
</li>
<li role="presentation">
<a href="#">Java中级</a>
</li>
<li role="presentation">
<a href="#">前端基础</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation">
<a href="#">服务端</a>
</li>
<li role="presentation">
<a href="#">框架</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td >面板(传统HTML不提供)</td>
<td>
<div class="panel panel-success">
<div class="panel-heading">面板标题</div>
<div class="panel-body">
面板内容<br>
面板内容<br>
面板内容
</div>
</div> </td>
</tr>
</table>
<!DOCTYPE html>
<script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script>
<link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet">
<script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script>
<table width="200" border="1" class="table table-bordered">
<tr>
<td>HTML</td>
<td>Bootstrap</td>
</tr>
<tr>
<td><button>按钮</button></td>
<td><button class="btn btn-success">按钮</button></td>
</tr>
<tr>
<td><input type="text" value="输入框"></td>
<td><input type="text" value="输入框" class="form-control"></td>
</tr>
<tr>
<td>
<select >
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
</select> </td>
<td>
<select class="form-control">
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
<option>多选框</option>
</select> </td>
</tr>
</tr>
<tr>
<td >下拉菜单(传统HTML不提供)</td>
<td>
<div class="dropdown">
<button type="button" class="btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
http://192.168.1.189
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li>
<a href="#">Java基础</a>
</li>
<li role="presentation">
<a href="#">Java中级</a>
</li>
<li role="presentation">
<a href="#">前端基础</a>
</li>
<li role="presentation" class="divider"></li>
<li role="presentation">
<a href="#">服务端</a>
</li>
<li role="presentation">
<a href="#">框架</a>
</li>
</ul>
</div>
</td>
</tr>
<tr>
<td >面板(传统HTML不提供)</td>
<td>
<div class="panel panel-success">
<div class="panel-heading">面板标题</div>
<div class="panel-body">
面板内容<br>
面板内容<br>
面板内容
</div>
</div> </td>
</tr>
</table>
");
window.frames["iframe1252"].document.write(decodeHtml(code1252));
window.frames["iframe1252"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1252"]).load(function(){
$("#iframe1252").height($("#iframe1252").contents().find("body").height()+showittryitheight);
});
$("#iframe1252").height($("#iframe1252").contents().find("body").height()+showittryitheight);
alreadyWriteCode1252 = code1252;
$("#rendering1252").hide();
$("#rendered1252").show();
}
var tRereshRetry2DemoPanel1252 = setInterval(rereshRetry2DemoPanel1252,1000);
var binded1252 = false;
$("textarea#stepcodeTextarea1252").keyup(function(){
if(!binded1252){
$(window).bind('beforeunload',function(){
binded1252 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1252 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1252!=newCode){
// window.frames["iframe1252"].document.write("
");
// window.frames["iframe1252"].document.write(decodeHtml($("textarea#stepcodeTextarea1252").val()));
// window.frames["iframe1252"].document.close();
// $(window.frames["iframe1252"]).load(function(){
// $("#iframe1252").height($("#iframe1252").contents().find("body").height()+showittryitheight);
// });
// code1252 = newCode;
// }
});
$(".tryButton1252").click(function(){
$("#tryDiv1252").show();
$("#stepcodeTextarea1252").focus();
$("#stepcodeTextarea1252").height(200);
$("#iframe1252").height(0);
window.frames["iframe1252"].document.write("
");
window.frames["iframe1252"].document.write(decodeHtml($("textarea#stepcodeTextarea1252").val()));
window.frames["iframe1252"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1252"]).load(function(){
$("#iframe1252").height($("#iframe1252").contents().find("body").height()+showittryitheight);
});
$("#iframe1252").height($("#iframe1252").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1252.focus();
editor1252.setSize(null, "250");
$("#rendering1252").hide();
$("#rendered1252").hide();
});
var mixedMode = {
name: "htmlmixed",
scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
mode: null},
{matches: /(text|application)\/(x-)?vb(a|script)/i,
mode: "vbscript"}]
};
var editor1252 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1252"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
mode:"text/html",
theme:"eclipse",
selectionPointer: true,
lineWrapping: true,
extraKeys: {
"Alt-/": "autocomplete",
"Ctrl-F": "findPersistent",
"F8": function(cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
},
"Esc": function(cm) {
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
}
}
});
editor1252.on("change",function(doc){
if(!binded1252){
$(window).bind('beforeunload',function(){
binded1252 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1252 = newCode;
$("textarea#stepcodeTextarea1252").val(newCode);
if(alreadyWriteCode1252!=code1252){
lastModifedTime1252 = new Date().getTime();
$("#rendering1252").show();
$("#rendered1252").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1252 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1252.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1252").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|