how2j.cn

"); window.frames["iframe_toc"+sid].document.write(decodeHtml($("pre#stepCodePre"+sid).html())); window.frames["iframe_toc"+sid].document.close(); $(window.frames["iframe_toc"+sid]).load(function(){ $("#iframe_toc"+sid).height($("#iframe_toc"+sid).contents().find("body").height()+(showittryitheight)); }); $("#iframe_toc"+sid).height($("#iframe_toc"+sid).contents().find("body").height()+(showittryitheight)); } $("input.tocName").hover(function(){ $(this).select(); }); function refresh(){ var sid = tocstepids.shift(); if(null!=sid) refreshIframe(sid); else go2ArchorFlag = true; } var t = setInterval(refresh,300); // $("div.steptoc iframe").height($(showittryitheight+50)); });
效果 样式(悬停可选中) 说明 示例代码
<!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>

<span class="text-muted">muted</span>
淡灰色文本
示例代码
<!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>

<span class="text-primary">primary</span>
强调的文本
示例代码
<!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>
 
<span class="text-success">success</span>
操作成功文本
示例代码
<!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>
 
<span class="text-info">info</span>
提示信息文本
示例代码
<!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>
 
<span class="text-warning">warning</span>
警告文本
示例代码
<!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>
 
<span class="text-danger">danger</span>
危险操作文本
示例代码
示例 1 : 淡灰色文本   
示例 2 : 强调的文本   
示例 3 : 操作成功文本   
示例 4 : 提示信息文本   
示例 5 : 警告文本   
示例 6 : 危险操作文本   

示例 1 :

淡灰色文本

淡灰色,常用在说明性文字
"); window.frames["iframe_show1013"].document.write(decodeHtml($("textarea#stepcodeTextarea1013").val())); window.frames["iframe_show1013"].document.close(); $(window.frames["iframe_show1013"]).load(function(){ $("#iframe_show1013").height($("#iframe_show1013").contents().find("body").height()+showittryitheight); }); $("#iframe_show1013").height($("#iframe_show1013").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> <span class="text-muted">muted</span>
<!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>

<span class="text-muted">muted</span>
"); window.frames["iframe1013"].document.write(decodeHtml(code1013)); window.frames["iframe1013"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1013"]).load(function(){ $("#iframe1013").height($("#iframe1013").contents().find("body").height()+showittryitheight); }); $("#iframe1013").height($("#iframe1013").contents().find("body").height()+showittryitheight); alreadyWriteCode1013 = code1013; $("#rendering1013").hide(); $("#rendered1013").show(); } var tRereshRetry2DemoPanel1013 = setInterval(rereshRetry2DemoPanel1013,1000); var binded1013 = false; $("textarea#stepcodeTextarea1013").keyup(function(){ if(!binded1013){ $(window).bind('beforeunload',function(){ binded1013 = true; return "xxxx"; }); } var newCode = $(this).val() code1013 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1013!=newCode){ // window.frames["iframe1013"].document.write("
"); // window.frames["iframe1013"].document.write(decodeHtml($("textarea#stepcodeTextarea1013").val())); // window.frames["iframe1013"].document.close(); // $(window.frames["iframe1013"]).load(function(){ // $("#iframe1013").height($("#iframe1013").contents().find("body").height()+showittryitheight); // }); // code1013 = newCode; // } }); $(".tryButton1013").click(function(){ $("#tryDiv1013").show(); $("#stepcodeTextarea1013").focus(); $("#stepcodeTextarea1013").height(200); $("#iframe1013").height(0); window.frames["iframe1013"].document.write("
"); window.frames["iframe1013"].document.write(decodeHtml($("textarea#stepcodeTextarea1013").val())); window.frames["iframe1013"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1013"]).load(function(){ $("#iframe1013").height($("#iframe1013").contents().find("body").height()+showittryitheight); }); $("#iframe1013").height($("#iframe1013").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1013.focus(); editor1013.setSize(null, "250"); $("#rendering1013").hide(); $("#rendered1013").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 editor1013 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1013"), { 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); } } }); editor1013.on("change",function(doc){ if(!binded1013){ $(window).bind('beforeunload',function(){ binded1013 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1013 = newCode; $("textarea#stepcodeTextarea1013").val(newCode); if(alreadyWriteCode1013!=code1013){ lastModifedTime1013 = new Date().getTime(); $("#rendering1013").show(); $("#rendered1013").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1013 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1013.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1013").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
示例 2 :

强调的文本

强调的文本,常用在需要强调的文字上
"); window.frames["iframe_show1025"].document.write(decodeHtml($("textarea#stepcodeTextarea1025").val())); window.frames["iframe_show1025"].document.close(); $(window.frames["iframe_show1025"]).load(function(){ $("#iframe_show1025").height($("#iframe_show1025").contents().find("body").height()+showittryitheight); }); $("#iframe_show1025").height($("#iframe_show1025").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> <span class="text-primary">primary</span>
<!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>

<span class="text-primary">primary</span>
"); window.frames["iframe1025"].document.write(decodeHtml(code1025)); window.frames["iframe1025"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1025"]).load(function(){ $("#iframe1025").height($("#iframe1025").contents().find("body").height()+showittryitheight); }); $("#iframe1025").height($("#iframe1025").contents().find("body").height()+showittryitheight); alreadyWriteCode1025 = code1025; $("#rendering1025").hide(); $("#rendered1025").show(); } var tRereshRetry2DemoPanel1025 = setInterval(rereshRetry2DemoPanel1025,1000); var binded1025 = false; $("textarea#stepcodeTextarea1025").keyup(function(){ if(!binded1025){ $(window).bind('beforeunload',function(){ binded1025 = true; return "xxxx"; }); } var newCode = $(this).val() code1025 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1025!=newCode){ // window.frames["iframe1025"].document.write("
"); // window.frames["iframe1025"].document.write(decodeHtml($("textarea#stepcodeTextarea1025").val())); // window.frames["iframe1025"].document.close(); // $(window.frames["iframe1025"]).load(function(){ // $("#iframe1025").height($("#iframe1025").contents().find("body").height()+showittryitheight); // }); // code1025 = newCode; // } }); $(".tryButton1025").click(function(){ $("#tryDiv1025").show(); $("#stepcodeTextarea1025").focus(); $("#stepcodeTextarea1025").height(200); $("#iframe1025").height(0); window.frames["iframe1025"].document.write("
"); window.frames["iframe1025"].document.write(decodeHtml($("textarea#stepcodeTextarea1025").val())); window.frames["iframe1025"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1025"]).load(function(){ $("#iframe1025").height($("#iframe1025").contents().find("body").height()+showittryitheight); }); $("#iframe1025").height($("#iframe1025").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1025.focus(); editor1025.setSize(null, "250"); $("#rendering1025").hide(); $("#rendered1025").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 editor1025 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1025"), { 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); } } }); editor1025.on("change",function(doc){ if(!binded1025){ $(window).bind('beforeunload',function(){ binded1025 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1025 = newCode; $("textarea#stepcodeTextarea1025").val(newCode); if(alreadyWriteCode1025!=code1025){ lastModifedTime1025 = new Date().getTime(); $("#rendering1025").show(); $("#rendered1025").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1025 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1025.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1025").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
示例 3 :

操作成功文本

操作成功文本,进行了成功的行为后的提示文字
"); window.frames["iframe_show1014"].document.write(decodeHtml($("textarea#stepcodeTextarea1014").val())); window.frames["iframe_show1014"].document.close(); $(window.frames["iframe_show1014"]).load(function(){ $("#iframe_show1014").height($("#iframe_show1014").contents().find("body").height()+showittryitheight); }); $("#iframe_show1014").height($("#iframe_show1014").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> <span class="text-success">success</span>
<!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>
 
<span class="text-success">success</span>
"); window.frames["iframe1014"].document.write(decodeHtml(code1014)); window.frames["iframe1014"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1014"]).load(function(){ $("#iframe1014").height($("#iframe1014").contents().find("body").height()+showittryitheight); }); $("#iframe1014").height($("#iframe1014").contents().find("body").height()+showittryitheight); alreadyWriteCode1014 = code1014; $("#rendering1014").hide(); $("#rendered1014").show(); } var tRereshRetry2DemoPanel1014 = setInterval(rereshRetry2DemoPanel1014,1000); var binded1014 = false; $("textarea#stepcodeTextarea1014").keyup(function(){ if(!binded1014){ $(window).bind('beforeunload',function(){ binded1014 = true; return "xxxx"; }); } var newCode = $(this).val() code1014 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1014!=newCode){ // window.frames["iframe1014"].document.write("
"); // window.frames["iframe1014"].document.write(decodeHtml($("textarea#stepcodeTextarea1014").val())); // window.frames["iframe1014"].document.close(); // $(window.frames["iframe1014"]).load(function(){ // $("#iframe1014").height($("#iframe1014").contents().find("body").height()+showittryitheight); // }); // code1014 = newCode; // } }); $(".tryButton1014").click(function(){ $("#tryDiv1014").show(); $("#stepcodeTextarea1014").focus(); $("#stepcodeTextarea1014").height(200); $("#iframe1014").height(0); window.frames["iframe1014"].document.write("
"); window.frames["iframe1014"].document.write(decodeHtml($("textarea#stepcodeTextarea1014").val())); window.frames["iframe1014"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1014"]).load(function(){ $("#iframe1014").height($("#iframe1014").contents().find("body").height()+showittryitheight); }); $("#iframe1014").height($("#iframe1014").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1014.focus(); editor1014.setSize(null, "250"); $("#rendering1014").hide(); $("#rendered1014").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 editor1014 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1014"), { 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); } } }); editor1014.on("change",function(doc){ if(!binded1014){ $(window).bind('beforeunload',function(){ binded1014 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1014 = newCode; $("textarea#stepcodeTextarea1014").val(newCode); if(alreadyWriteCode1014!=code1014){ lastModifedTime1014 = new Date().getTime(); $("#rendering1014").show(); $("#rendered1014").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1014 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1014.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1014").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
示例 4 :

提示信息文本

提示信息文本,一般用于指导性文字上
"); window.frames["iframe_show1015"].document.write(decodeHtml($("textarea#stepcodeTextarea1015").val())); window.frames["iframe_show1015"].document.close(); $(window.frames["iframe_show1015"]).load(function(){ $("#iframe_show1015").height($("#iframe_show1015").contents().find("body").height()+showittryitheight); }); $("#iframe_show1015").height($("#iframe_show1015").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> <span class="text-info">info</span>
<!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>
 
<span class="text-info">info</span>
"); window.frames["iframe1015"].document.write(decodeHtml(code1015)); window.frames["iframe1015"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1015"]).load(function(){ $("#iframe1015").height($("#iframe1015").contents().find("body").height()+showittryitheight); }); $("#iframe1015").height($("#iframe1015").contents().find("body").height()+showittryitheight); alreadyWriteCode1015 = code1015; $("#rendering1015").hide(); $("#rendered1015").show(); } var tRereshRetry2DemoPanel1015 = setInterval(rereshRetry2DemoPanel1015,1000); var binded1015 = false; $("textarea#stepcodeTextarea1015").keyup(function(){ if(!binded1015){ $(window).bind('beforeunload',function(){ binded1015 = true; return "xxxx"; }); } var newCode = $(this).val() code1015 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1015!=newCode){ // window.frames["iframe1015"].document.write("
"); // window.frames["iframe1015"].document.write(decodeHtml($("textarea#stepcodeTextarea1015").val())); // window.frames["iframe1015"].document.close(); // $(window.frames["iframe1015"]).load(function(){ // $("#iframe1015").height($("#iframe1015").contents().find("body").height()+showittryitheight); // }); // code1015 = newCode; // } }); $(".tryButton1015").click(function(){ $("#tryDiv1015").show(); $("#stepcodeTextarea1015").focus(); $("#stepcodeTextarea1015").height(200); $("#iframe1015").height(0); window.frames["iframe1015"].document.write("
"); window.frames["iframe1015"].document.write(decodeHtml($("textarea#stepcodeTextarea1015").val())); window.frames["iframe1015"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1015"]).load(function(){ $("#iframe1015").height($("#iframe1015").contents().find("body").height()+showittryitheight); }); $("#iframe1015").height($("#iframe1015").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1015.focus(); editor1015.setSize(null, "250"); $("#rendering1015").hide(); $("#rendered1015").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 editor1015 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1015"), { 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); } } }); editor1015.on("change",function(doc){ if(!binded1015){ $(window).bind('beforeunload',function(){ binded1015 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1015 = newCode; $("textarea#stepcodeTextarea1015").val(newCode); if(alreadyWriteCode1015!=code1015){ lastModifedTime1015 = new Date().getTime(); $("#rendering1015").show(); $("#rendered1015").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1015 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1015.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1015").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
示例 5 :

警告文本

警告文本,一般用于修改行为
"); window.frames["iframe_show1016"].document.write(decodeHtml($("textarea#stepcodeTextarea1016").val())); window.frames["iframe_show1016"].document.close(); $(window.frames["iframe_show1016"]).load(function(){ $("#iframe_show1016").height($("#iframe_show1016").contents().find("body").height()+showittryitheight); }); $("#iframe_show1016").height($("#iframe_show1016").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> <span class="text-warning">warning</span>
<!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>
 
<span class="text-warning">warning</span>
"); window.frames["iframe1016"].document.write(decodeHtml(code1016)); window.frames["iframe1016"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1016"]).load(function(){ $("#iframe1016").height($("#iframe1016").contents().find("body").height()+showittryitheight); }); $("#iframe1016").height($("#iframe1016").contents().find("body").height()+showittryitheight); alreadyWriteCode1016 = code1016; $("#rendering1016").hide(); $("#rendered1016").show(); } var tRereshRetry2DemoPanel1016 = setInterval(rereshRetry2DemoPanel1016,1000); var binded1016 = false; $("textarea#stepcodeTextarea1016").keyup(function(){ if(!binded1016){ $(window).bind('beforeunload',function(){ binded1016 = true; return "xxxx"; }); } var newCode = $(this).val() code1016 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1016!=newCode){ // window.frames["iframe1016"].document.write("
"); // window.frames["iframe1016"].document.write(decodeHtml($("textarea#stepcodeTextarea1016").val())); // window.frames["iframe1016"].document.close(); // $(window.frames["iframe1016"]).load(function(){ // $("#iframe1016").height($("#iframe1016").contents().find("body").height()+showittryitheight); // }); // code1016 = newCode; // } }); $(".tryButton1016").click(function(){ $("#tryDiv1016").show(); $("#stepcodeTextarea1016").focus(); $("#stepcodeTextarea1016").height(200); $("#iframe1016").height(0); window.frames["iframe1016"].document.write("
"); window.frames["iframe1016"].document.write(decodeHtml($("textarea#stepcodeTextarea1016").val())); window.frames["iframe1016"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1016"]).load(function(){ $("#iframe1016").height($("#iframe1016").contents().find("body").height()+showittryitheight); }); $("#iframe1016").height($("#iframe1016").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1016.focus(); editor1016.setSize(null, "250"); $("#rendering1016").hide(); $("#rendered1016").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 editor1016 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1016"), { 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); } } }); editor1016.on("change",function(doc){ if(!binded1016){ $(window).bind('beforeunload',function(){ binded1016 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1016 = newCode; $("textarea#stepcodeTextarea1016").val(newCode); if(alreadyWriteCode1016!=code1016){ lastModifedTime1016 = new Date().getTime(); $("#rendering1016").show(); $("#rendered1016").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1016 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1016.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1016").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
示例 6 :

危险操作文本

危险操作文本,一般用于删除行为
"); window.frames["iframe_show1019"].document.write(decodeHtml($("textarea#stepcodeTextarea1019").val())); window.frames["iframe_show1019"].document.close(); $(window.frames["iframe_show1019"]).load(function(){ $("#iframe_show1019").height($("#iframe_show1019").contents().find("body").height()+showittryitheight); }); $("#iframe_show1019").height($("#iframe_show1019").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> <span class="text-danger">danger</span>
<!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>
 
<span class="text-danger">danger</span>
"); window.frames["iframe1019"].document.write(decodeHtml(code1019)); window.frames["iframe1019"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1019"]).load(function(){ $("#iframe1019").height($("#iframe1019").contents().find("body").height()+showittryitheight); }); $("#iframe1019").height($("#iframe1019").contents().find("body").height()+showittryitheight); alreadyWriteCode1019 = code1019; $("#rendering1019").hide(); $("#rendered1019").show(); } var tRereshRetry2DemoPanel1019 = setInterval(rereshRetry2DemoPanel1019,1000); var binded1019 = false; $("textarea#stepcodeTextarea1019").keyup(function(){ if(!binded1019){ $(window).bind('beforeunload',function(){ binded1019 = true; return "xxxx"; }); } var newCode = $(this).val() code1019 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1019!=newCode){ // window.frames["iframe1019"].document.write("
"); // window.frames["iframe1019"].document.write(decodeHtml($("textarea#stepcodeTextarea1019").val())); // window.frames["iframe1019"].document.close(); // $(window.frames["iframe1019"]).load(function(){ // $("#iframe1019").height($("#iframe1019").contents().find("body").height()+showittryitheight); // }); // code1019 = newCode; // } }); $(".tryButton1019").click(function(){ $("#tryDiv1019").show(); $("#stepcodeTextarea1019").focus(); $("#stepcodeTextarea1019").height(200); $("#iframe1019").height(0); window.frames["iframe1019"].document.write("
"); window.frames["iframe1019"].document.write(decodeHtml($("textarea#stepcodeTextarea1019").val())); window.frames["iframe1019"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1019"]).load(function(){ $("#iframe1019").height($("#iframe1019").contents().find("body").height()+showittryitheight); }); $("#iframe1019").height($("#iframe1019").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1019.focus(); editor1019.setSize(null, "250"); $("#rendering1019").hide(); $("#rendered1019").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 editor1019 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1019"), { 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); } } }); editor1019.on("change",function(doc){ if(!binded1019){ $(window).bind('beforeunload',function(){ binded1019 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1019 = newCode; $("textarea#stepcodeTextarea1019").val(newCode); if(alreadyWriteCode1019!=code1019){ lastModifedTime1019 = new Date().getTime(); $("#rendering1019").show(); $("#rendered1019").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1019 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1019.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1019").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果


HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。


关于 前端部分-BootStrap-文本 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 620943819
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: http://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图