步骤
1
:
<!DOCTYPE html>
顶
折
因为bootstrap用到了html5的特性,为了正常使用,需要在最开头加上
<!DOCTYPE html>
<!DOCTYPE html>
接着导入js和css
Bootstrap需要JQuery才能正常工作,所以需要导入jquery.min.js
接着是 Bootstrap的css,里面定义了各种样式
最后是 Bootstrap的js,用于产生交互效果,比如关闭警告框
注:顺序不要搞错了,否则有一些效果会出不来。
首先是JQuery
然后是Bootstrap css
最后是Bootstrap js
。
<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>
<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>
接着就是出现BootStrap的效果,使用是非常简单的,只需要套用 bootstrap css中定义的class即可。
如按钮,增加class btn btn-success 就能有bootstrap的效果了
简单的吓死人
");
window.frames["iframe_show1256"].document.write(decodeHtml($("textarea#stepcodeTextarea1256").val()));
window.frames["iframe_show1256"].document.close();
$(window.frames["iframe_show1256"]).load(function(){
$("#iframe_show1256").height($("#iframe_show1256").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1256").height($("#iframe_show1256").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>
<button class="btn btn-success">按钮</button>
<!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>
<button class="btn btn-success">按钮</button>
");
window.frames["iframe1256"].document.write(decodeHtml(code1256));
window.frames["iframe1256"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1256"]).load(function(){
$("#iframe1256").height($("#iframe1256").contents().find("body").height()+showittryitheight);
});
$("#iframe1256").height($("#iframe1256").contents().find("body").height()+showittryitheight);
alreadyWriteCode1256 = code1256;
$("#rendering1256").hide();
$("#rendered1256").show();
}
var tRereshRetry2DemoPanel1256 = setInterval(rereshRetry2DemoPanel1256,1000);
var binded1256 = false;
$("textarea#stepcodeTextarea1256").keyup(function(){
if(!binded1256){
$(window).bind('beforeunload',function(){
binded1256 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1256 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1256!=newCode){
// window.frames["iframe1256"].document.write("
");
// window.frames["iframe1256"].document.write(decodeHtml($("textarea#stepcodeTextarea1256").val()));
// window.frames["iframe1256"].document.close();
// $(window.frames["iframe1256"]).load(function(){
// $("#iframe1256").height($("#iframe1256").contents().find("body").height()+showittryitheight);
// });
// code1256 = newCode;
// }
});
$(".tryButton1256").click(function(){
$("#tryDiv1256").show();
$("#stepcodeTextarea1256").focus();
$("#stepcodeTextarea1256").height(200);
$("#iframe1256").height(0);
window.frames["iframe1256"].document.write("
");
window.frames["iframe1256"].document.write(decodeHtml($("textarea#stepcodeTextarea1256").val()));
window.frames["iframe1256"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1256"]).load(function(){
$("#iframe1256").height($("#iframe1256").contents().find("body").height()+showittryitheight);
});
$("#iframe1256").height($("#iframe1256").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1256.focus();
editor1256.setSize(null, "250");
$("#rendering1256").hide();
$("#rendered1256").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 editor1256 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1256"), {
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);
}
}
});
editor1256.on("change",function(doc){
if(!binded1256){
$(window).bind('beforeunload',function(){
binded1256 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1256 = newCode;
$("textarea#stepcodeTextarea1256").val(newCode);
if(alreadyWriteCode1256!=code1256){
lastModifedTime1256 = new Date().getTime();
$("#rendering1256").show();
$("#rendered1256").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1256 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1256.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1256").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|