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>
  
   <button type="button" class="close" aria-hidden="true">
      &times;
   </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>
  
<span class="caret"></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>
  
<div class="pull-left">文字浮动到左边</div>
左浮动
示例代码
<!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>
  
<div class="pull-right">文字浮动到右边</div>
右浮动
示例代码
<!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>
  
<div class="show">显示</div>
显示
示例代码
<!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>
  
<div class="show">显示1</div>
<div class="hidden">隐藏</div>
<div class="show">显示3</div>
隐藏
示例代码
<!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>
  
<div class="show">显示1</div>
<div class="invisible">隐藏</div>
<div class="show">显示3</div>
隐藏
示例代码
示例 1 : 关闭按钮   
示例 2 : 下拉菜单的按钮   
示例 3 : 左浮动   
示例 4 : 右浮动   
示例 5 : 显示   
示例 6 : 隐藏   
示例 7 : 隐藏   

示例 1 :

关闭按钮

关闭按钮,一般用于切换效果
"); window.frames["iframe_show1263"].document.write(decodeHtml($("textarea#stepcodeTextarea1263").val())); window.frames["iframe_show1263"].document.close(); $(window.frames["iframe_show1263"]).load(function(){ $("#iframe_show1263").height($("#iframe_show1263").contents().find("body").height()+showittryitheight); }); $("#iframe_show1263").height($("#iframe_show1263").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 type="button" class="close" aria-hidden="true"> &times; </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 type="button" class="close" aria-hidden="true">
      &times;
   </button>
"); window.frames["iframe1263"].document.write(decodeHtml(code1263)); window.frames["iframe1263"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1263"]).load(function(){ $("#iframe1263").height($("#iframe1263").contents().find("body").height()+showittryitheight); }); $("#iframe1263").height($("#iframe1263").contents().find("body").height()+showittryitheight); alreadyWriteCode1263 = code1263; $("#rendering1263").hide(); $("#rendered1263").show(); } var tRereshRetry2DemoPanel1263 = setInterval(rereshRetry2DemoPanel1263,1000); var binded1263 = false; $("textarea#stepcodeTextarea1263").keyup(function(){ if(!binded1263){ $(window).bind('beforeunload',function(){ binded1263 = true; return "xxxx"; }); } var newCode = $(this).val() code1263 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1263!=newCode){ // window.frames["iframe1263"].document.write("
"); // window.frames["iframe1263"].document.write(decodeHtml($("textarea#stepcodeTextarea1263").val())); // window.frames["iframe1263"].document.close(); // $(window.frames["iframe1263"]).load(function(){ // $("#iframe1263").height($("#iframe1263").contents().find("body").height()+showittryitheight); // }); // code1263 = newCode; // } }); $(".tryButton1263").click(function(){ $("#tryDiv1263").show(); $("#stepcodeTextarea1263").focus(); $("#stepcodeTextarea1263").height(200); $("#iframe1263").height(0); window.frames["iframe1263"].document.write("
"); window.frames["iframe1263"].document.write(decodeHtml($("textarea#stepcodeTextarea1263").val())); window.frames["iframe1263"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1263"]).load(function(){ $("#iframe1263").height($("#iframe1263").contents().find("body").height()+showittryitheight); }); $("#iframe1263").height($("#iframe1263").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1263.focus(); editor1263.setSize(null, "250"); $("#rendering1263").hide(); $("#rendered1263").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 editor1263 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1263"), { 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); } } }); editor1263.on("change",function(doc){ if(!binded1263){ $(window).bind('beforeunload',function(){ binded1263 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1263 = newCode; $("textarea#stepcodeTextarea1263").val(newCode); if(alreadyWriteCode1263!=code1263){ lastModifedTime1263 = new Date().getTime(); $("#rendering1263").show(); $("#rendered1263").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1263 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1263.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1263").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

下拉菜单的按钮

下拉菜单的按钮
"); window.frames["iframe_show1264"].document.write(decodeHtml($("textarea#stepcodeTextarea1264").val())); window.frames["iframe_show1264"].document.close(); $(window.frames["iframe_show1264"]).load(function(){ $("#iframe_show1264").height($("#iframe_show1264").contents().find("body").height()+showittryitheight); }); $("#iframe_show1264").height($("#iframe_show1264").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="caret"></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="caret"></span>
"); window.frames["iframe1264"].document.write(decodeHtml(code1264)); window.frames["iframe1264"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1264"]).load(function(){ $("#iframe1264").height($("#iframe1264").contents().find("body").height()+showittryitheight); }); $("#iframe1264").height($("#iframe1264").contents().find("body").height()+showittryitheight); alreadyWriteCode1264 = code1264; $("#rendering1264").hide(); $("#rendered1264").show(); } var tRereshRetry2DemoPanel1264 = setInterval(rereshRetry2DemoPanel1264,1000); var binded1264 = false; $("textarea#stepcodeTextarea1264").keyup(function(){ if(!binded1264){ $(window).bind('beforeunload',function(){ binded1264 = true; return "xxxx"; }); } var newCode = $(this).val() code1264 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1264!=newCode){ // window.frames["iframe1264"].document.write("
"); // window.frames["iframe1264"].document.write(decodeHtml($("textarea#stepcodeTextarea1264").val())); // window.frames["iframe1264"].document.close(); // $(window.frames["iframe1264"]).load(function(){ // $("#iframe1264").height($("#iframe1264").contents().find("body").height()+showittryitheight); // }); // code1264 = newCode; // } }); $(".tryButton1264").click(function(){ $("#tryDiv1264").show(); $("#stepcodeTextarea1264").focus(); $("#stepcodeTextarea1264").height(200); $("#iframe1264").height(0); window.frames["iframe1264"].document.write("
"); window.frames["iframe1264"].document.write(decodeHtml($("textarea#stepcodeTextarea1264").val())); window.frames["iframe1264"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1264"]).load(function(){ $("#iframe1264").height($("#iframe1264").contents().find("body").height()+showittryitheight); }); $("#iframe1264").height($("#iframe1264").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1264.focus(); editor1264.setSize(null, "250"); $("#rendering1264").hide(); $("#rendered1264").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 editor1264 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1264"), { 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); } } }); editor1264.on("change",function(doc){ if(!binded1264){ $(window).bind('beforeunload',function(){ binded1264 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1264 = newCode; $("textarea#stepcodeTextarea1264").val(newCode); if(alreadyWriteCode1264!=code1264){ lastModifedTime1264 = new Date().getTime(); $("#rendering1264").show(); $("#rendered1264").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1264 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1264.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1264").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

左浮动

左浮动 ,相当于css中的float:left
"); window.frames["iframe_show1265"].document.write(decodeHtml($("textarea#stepcodeTextarea1265").val())); window.frames["iframe_show1265"].document.close(); $(window.frames["iframe_show1265"]).load(function(){ $("#iframe_show1265").height($("#iframe_show1265").contents().find("body").height()+showittryitheight); }); $("#iframe_show1265").height($("#iframe_show1265").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> <div class="pull-left">文字浮动到左边</div>
<!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>
  
<div class="pull-left">文字浮动到左边</div>
"); window.frames["iframe1265"].document.write(decodeHtml(code1265)); window.frames["iframe1265"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1265"]).load(function(){ $("#iframe1265").height($("#iframe1265").contents().find("body").height()+showittryitheight); }); $("#iframe1265").height($("#iframe1265").contents().find("body").height()+showittryitheight); alreadyWriteCode1265 = code1265; $("#rendering1265").hide(); $("#rendered1265").show(); } var tRereshRetry2DemoPanel1265 = setInterval(rereshRetry2DemoPanel1265,1000); var binded1265 = false; $("textarea#stepcodeTextarea1265").keyup(function(){ if(!binded1265){ $(window).bind('beforeunload',function(){ binded1265 = true; return "xxxx"; }); } var newCode = $(this).val() code1265 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1265!=newCode){ // window.frames["iframe1265"].document.write("
"); // window.frames["iframe1265"].document.write(decodeHtml($("textarea#stepcodeTextarea1265").val())); // window.frames["iframe1265"].document.close(); // $(window.frames["iframe1265"]).load(function(){ // $("#iframe1265").height($("#iframe1265").contents().find("body").height()+showittryitheight); // }); // code1265 = newCode; // } }); $(".tryButton1265").click(function(){ $("#tryDiv1265").show(); $("#stepcodeTextarea1265").focus(); $("#stepcodeTextarea1265").height(200); $("#iframe1265").height(0); window.frames["iframe1265"].document.write("
"); window.frames["iframe1265"].document.write(decodeHtml($("textarea#stepcodeTextarea1265").val())); window.frames["iframe1265"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1265"]).load(function(){ $("#iframe1265").height($("#iframe1265").contents().find("body").height()+showittryitheight); }); $("#iframe1265").height($("#iframe1265").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1265.focus(); editor1265.setSize(null, "250"); $("#rendering1265").hide(); $("#rendered1265").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 editor1265 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1265"), { 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); } } }); editor1265.on("change",function(doc){ if(!binded1265){ $(window).bind('beforeunload',function(){ binded1265 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1265 = newCode; $("textarea#stepcodeTextarea1265").val(newCode); if(alreadyWriteCode1265!=code1265){ lastModifedTime1265 = new Date().getTime(); $("#rendering1265").show(); $("#rendered1265").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1265 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1265.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1265").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

右浮动

右浮动 ,相当于css中的float:right
"); window.frames["iframe_show1266"].document.write(decodeHtml($("textarea#stepcodeTextarea1266").val())); window.frames["iframe_show1266"].document.close(); $(window.frames["iframe_show1266"]).load(function(){ $("#iframe_show1266").height($("#iframe_show1266").contents().find("body").height()+showittryitheight); }); $("#iframe_show1266").height($("#iframe_show1266").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> <div class="pull-right">文字浮动到右边</div>
<!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>
  
<div class="pull-right">文字浮动到右边</div>
"); window.frames["iframe1266"].document.write(decodeHtml(code1266)); window.frames["iframe1266"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1266"]).load(function(){ $("#iframe1266").height($("#iframe1266").contents().find("body").height()+showittryitheight); }); $("#iframe1266").height($("#iframe1266").contents().find("body").height()+showittryitheight); alreadyWriteCode1266 = code1266; $("#rendering1266").hide(); $("#rendered1266").show(); } var tRereshRetry2DemoPanel1266 = setInterval(rereshRetry2DemoPanel1266,1000); var binded1266 = false; $("textarea#stepcodeTextarea1266").keyup(function(){ if(!binded1266){ $(window).bind('beforeunload',function(){ binded1266 = true; return "xxxx"; }); } var newCode = $(this).val() code1266 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1266!=newCode){ // window.frames["iframe1266"].document.write("
"); // window.frames["iframe1266"].document.write(decodeHtml($("textarea#stepcodeTextarea1266").val())); // window.frames["iframe1266"].document.close(); // $(window.frames["iframe1266"]).load(function(){ // $("#iframe1266").height($("#iframe1266").contents().find("body").height()+showittryitheight); // }); // code1266 = newCode; // } }); $(".tryButton1266").click(function(){ $("#tryDiv1266").show(); $("#stepcodeTextarea1266").focus(); $("#stepcodeTextarea1266").height(200); $("#iframe1266").height(0); window.frames["iframe1266"].document.write("
"); window.frames["iframe1266"].document.write(decodeHtml($("textarea#stepcodeTextarea1266").val())); window.frames["iframe1266"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1266"]).load(function(){ $("#iframe1266").height($("#iframe1266").contents().find("body").height()+showittryitheight); }); $("#iframe1266").height($("#iframe1266").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1266.focus(); editor1266.setSize(null, "250"); $("#rendering1266").hide(); $("#rendered1266").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 editor1266 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1266"), { 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); } } }); editor1266.on("change",function(doc){ if(!binded1266){ $(window).bind('beforeunload',function(){ binded1266 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1266 = newCode; $("textarea#stepcodeTextarea1266").val(newCode); if(alreadyWriteCode1266!=code1266){ lastModifedTime1266 = new Date().getTime(); $("#rendering1266").show(); $("#rendered1266").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1266 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1266.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1266").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

显示

强行显示
"); window.frames["iframe_show1269"].document.write(decodeHtml($("textarea#stepcodeTextarea1269").val())); window.frames["iframe_show1269"].document.close(); $(window.frames["iframe_show1269"]).load(function(){ $("#iframe_show1269").height($("#iframe_show1269").contents().find("body").height()+showittryitheight); }); $("#iframe_show1269").height($("#iframe_show1269").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> <div class="show">显示</div>
<!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>
  
<div class="show">显示</div>
"); window.frames["iframe1269"].document.write(decodeHtml(code1269)); window.frames["iframe1269"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1269"]).load(function(){ $("#iframe1269").height($("#iframe1269").contents().find("body").height()+showittryitheight); }); $("#iframe1269").height($("#iframe1269").contents().find("body").height()+showittryitheight); alreadyWriteCode1269 = code1269; $("#rendering1269").hide(); $("#rendered1269").show(); } var tRereshRetry2DemoPanel1269 = setInterval(rereshRetry2DemoPanel1269,1000); var binded1269 = false; $("textarea#stepcodeTextarea1269").keyup(function(){ if(!binded1269){ $(window).bind('beforeunload',function(){ binded1269 = true; return "xxxx"; }); } var newCode = $(this).val() code1269 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1269!=newCode){ // window.frames["iframe1269"].document.write("
"); // window.frames["iframe1269"].document.write(decodeHtml($("textarea#stepcodeTextarea1269").val())); // window.frames["iframe1269"].document.close(); // $(window.frames["iframe1269"]).load(function(){ // $("#iframe1269").height($("#iframe1269").contents().find("body").height()+showittryitheight); // }); // code1269 = newCode; // } }); $(".tryButton1269").click(function(){ $("#tryDiv1269").show(); $("#stepcodeTextarea1269").focus(); $("#stepcodeTextarea1269").height(200); $("#iframe1269").height(0); window.frames["iframe1269"].document.write("
"); window.frames["iframe1269"].document.write(decodeHtml($("textarea#stepcodeTextarea1269").val())); window.frames["iframe1269"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1269"]).load(function(){ $("#iframe1269").height($("#iframe1269").contents().find("body").height()+showittryitheight); }); $("#iframe1269").height($("#iframe1269").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1269.focus(); editor1269.setSize(null, "250"); $("#rendering1269").hide(); $("#rendered1269").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 editor1269 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1269"), { 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); } } }); editor1269.on("change",function(doc){ if(!binded1269){ $(window).bind('beforeunload',function(){ binded1269 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1269 = newCode; $("textarea#stepcodeTextarea1269").val(newCode); if(alreadyWriteCode1269!=code1269){ lastModifedTime1269 = new Date().getTime(); $("#rendering1269").show(); $("#rendered1269").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1269 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1269.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1269").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

隐藏

强行隐藏,会把该元素的位置也让出来
"); window.frames["iframe_show1270"].document.write(decodeHtml($("textarea#stepcodeTextarea1270").val())); window.frames["iframe_show1270"].document.close(); $(window.frames["iframe_show1270"]).load(function(){ $("#iframe_show1270").height($("#iframe_show1270").contents().find("body").height()+showittryitheight); }); $("#iframe_show1270").height($("#iframe_show1270").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> <div class="show">显示1</div> <div class="hidden">隐藏</div> <div class="show">显示3</div>
<!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>
  
<div class="show">显示1</div>
<div class="hidden">隐藏</div>
<div class="show">显示3</div>
"); window.frames["iframe1270"].document.write(decodeHtml(code1270)); window.frames["iframe1270"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1270"]).load(function(){ $("#iframe1270").height($("#iframe1270").contents().find("body").height()+showittryitheight); }); $("#iframe1270").height($("#iframe1270").contents().find("body").height()+showittryitheight); alreadyWriteCode1270 = code1270; $("#rendering1270").hide(); $("#rendered1270").show(); } var tRereshRetry2DemoPanel1270 = setInterval(rereshRetry2DemoPanel1270,1000); var binded1270 = false; $("textarea#stepcodeTextarea1270").keyup(function(){ if(!binded1270){ $(window).bind('beforeunload',function(){ binded1270 = true; return "xxxx"; }); } var newCode = $(this).val() code1270 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1270!=newCode){ // window.frames["iframe1270"].document.write("
"); // window.frames["iframe1270"].document.write(decodeHtml($("textarea#stepcodeTextarea1270").val())); // window.frames["iframe1270"].document.close(); // $(window.frames["iframe1270"]).load(function(){ // $("#iframe1270").height($("#iframe1270").contents().find("body").height()+showittryitheight); // }); // code1270 = newCode; // } }); $(".tryButton1270").click(function(){ $("#tryDiv1270").show(); $("#stepcodeTextarea1270").focus(); $("#stepcodeTextarea1270").height(200); $("#iframe1270").height(0); window.frames["iframe1270"].document.write("
"); window.frames["iframe1270"].document.write(decodeHtml($("textarea#stepcodeTextarea1270").val())); window.frames["iframe1270"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1270"]).load(function(){ $("#iframe1270").height($("#iframe1270").contents().find("body").height()+showittryitheight); }); $("#iframe1270").height($("#iframe1270").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1270.focus(); editor1270.setSize(null, "250"); $("#rendering1270").hide(); $("#rendered1270").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 editor1270 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1270"), { 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); } } }); editor1270.on("change",function(doc){ if(!binded1270){ $(window).bind('beforeunload',function(){ binded1270 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1270 = newCode; $("textarea#stepcodeTextarea1270").val(newCode); if(alreadyWriteCode1270!=code1270){ lastModifedTime1270 = new Date().getTime(); $("#rendering1270").show(); $("#rendered1270").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1270 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1270.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1270").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

隐藏

强行隐藏,该元素的位置会保留
"); window.frames["iframe_show1271"].document.write(decodeHtml($("textarea#stepcodeTextarea1271").val())); window.frames["iframe_show1271"].document.close(); $(window.frames["iframe_show1271"]).load(function(){ $("#iframe_show1271").height($("#iframe_show1271").contents().find("body").height()+showittryitheight); }); $("#iframe_show1271").height($("#iframe_show1271").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> <div class="show">显示1</div> <div class="invisible">隐藏</div> <div class="show">显示3</div>
<!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>
  
<div class="show">显示1</div>
<div class="invisible">隐藏</div>
<div class="show">显示3</div>
"); window.frames["iframe1271"].document.write(decodeHtml(code1271)); window.frames["iframe1271"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1271"]).load(function(){ $("#iframe1271").height($("#iframe1271").contents().find("body").height()+showittryitheight); }); $("#iframe1271").height($("#iframe1271").contents().find("body").height()+showittryitheight); alreadyWriteCode1271 = code1271; $("#rendering1271").hide(); $("#rendered1271").show(); } var tRereshRetry2DemoPanel1271 = setInterval(rereshRetry2DemoPanel1271,1000); var binded1271 = false; $("textarea#stepcodeTextarea1271").keyup(function(){ if(!binded1271){ $(window).bind('beforeunload',function(){ binded1271 = true; return "xxxx"; }); } var newCode = $(this).val() code1271 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code1271!=newCode){ // window.frames["iframe1271"].document.write("
"); // window.frames["iframe1271"].document.write(decodeHtml($("textarea#stepcodeTextarea1271").val())); // window.frames["iframe1271"].document.close(); // $(window.frames["iframe1271"]).load(function(){ // $("#iframe1271").height($("#iframe1271").contents().find("body").height()+showittryitheight); // }); // code1271 = newCode; // } }); $(".tryButton1271").click(function(){ $("#tryDiv1271").show(); $("#stepcodeTextarea1271").focus(); $("#stepcodeTextarea1271").height(200); $("#iframe1271").height(0); window.frames["iframe1271"].document.write("
"); window.frames["iframe1271"].document.write(decodeHtml($("textarea#stepcodeTextarea1271").val())); window.frames["iframe1271"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe1271"]).load(function(){ $("#iframe1271").height($("#iframe1271").contents().find("body").height()+showittryitheight); }); $("#iframe1271").height($("#iframe1271").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor1271.focus(); editor1271.setSize(null, "250"); $("#rendering1271").hide(); $("#rendered1271").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 editor1271 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1271"), { 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); } } }); editor1271.on("change",function(doc){ if(!binded1271){ $(window).bind('beforeunload',function(){ binded1271 = true; return "xxxx"; }); } var newCode = doc.getValue(); code1271 = newCode; $("textarea#stepcodeTextarea1271").val(newCode); if(alreadyWriteCode1271!=code1271){ lastModifedTime1271 = new Date().getTime(); $("#rendering1271").show(); $("#rendered1271").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor1271 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor1271.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv1271").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

上传截图