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 class="btn btn-default" title="提示信息">非Bootstrap工具提示</button>
非Bootstrap工具提示
示例代码
<!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 style="margin-left:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
左侧提示
示例代码
<!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 style="margin-right:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
右侧提示
示例代码
<!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 style="margin-top:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
上方提示
示例代码
<!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 style="margin-bottom:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
下方提示
示例代码
示例 1 : 非Bootstrap工具提示   
示例 2 : 左侧提示   
示例 3 : 右侧提示   
示例 4 : 上方提示   
示例 5 : 下方提示   

示例 1 :

非Bootstrap工具提示

非Bootstrap工具提示
"); window.frames["iframe_show3010"].document.write(decodeHtml($("textarea#stepcodeTextarea3010").val())); window.frames["iframe_show3010"].document.close(); $(window.frames["iframe_show3010"]).load(function(){ $("#iframe_show3010").height($("#iframe_show3010").contents().find("body").height()+showittryitheight); }); $("#iframe_show3010").height($("#iframe_show3010").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-default" title="提示信息">非Bootstrap工具提示</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-default" title="提示信息">非Bootstrap工具提示</button>
"); window.frames["iframe3010"].document.write(decodeHtml(code3010)); window.frames["iframe3010"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3010"]).load(function(){ $("#iframe3010").height($("#iframe3010").contents().find("body").height()+showittryitheight); }); $("#iframe3010").height($("#iframe3010").contents().find("body").height()+showittryitheight); alreadyWriteCode3010 = code3010; $("#rendering3010").hide(); $("#rendered3010").show(); } var tRereshRetry2DemoPanel3010 = setInterval(rereshRetry2DemoPanel3010,1000); var binded3010 = false; $("textarea#stepcodeTextarea3010").keyup(function(){ if(!binded3010){ $(window).bind('beforeunload',function(){ binded3010 = true; return "xxxx"; }); } var newCode = $(this).val() code3010 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3010!=newCode){ // window.frames["iframe3010"].document.write("
"); // window.frames["iframe3010"].document.write(decodeHtml($("textarea#stepcodeTextarea3010").val())); // window.frames["iframe3010"].document.close(); // $(window.frames["iframe3010"]).load(function(){ // $("#iframe3010").height($("#iframe3010").contents().find("body").height()+showittryitheight); // }); // code3010 = newCode; // } }); $(".tryButton3010").click(function(){ $("#tryDiv3010").show(); $("#stepcodeTextarea3010").focus(); $("#stepcodeTextarea3010").height(200); $("#iframe3010").height(0); window.frames["iframe3010"].document.write("
"); window.frames["iframe3010"].document.write(decodeHtml($("textarea#stepcodeTextarea3010").val())); window.frames["iframe3010"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3010"]).load(function(){ $("#iframe3010").height($("#iframe3010").contents().find("body").height()+showittryitheight); }); $("#iframe3010").height($("#iframe3010").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3010.focus(); editor3010.setSize(null, "250"); $("#rendering3010").hide(); $("#rendered3010").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 editor3010 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3010"), { 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); } } }); editor3010.on("change",function(doc){ if(!binded3010){ $(window).bind('beforeunload',function(){ binded3010 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3010 = newCode; $("textarea#stepcodeTextarea3010").val(newCode); if(alreadyWriteCode3010!=code3010){ lastModifedTime3010 = new Date().getTime(); $("#rendering3010").show(); $("#rendered3010").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3010 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3010.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3010").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

左侧提示

左侧提示
"); window.frames["iframe_show3011"].document.write(decodeHtml($("textarea#stepcodeTextarea3011").val())); window.frames["iframe_show3011"].document.close(); $(window.frames["iframe_show3011"]).load(function(){ $("#iframe_show3011").height($("#iframe_show3011").contents().find("body").height()+showittryitheight); }); $("#iframe_show3011").height($("#iframe_show3011").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 style="margin-left:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="提示信息">鼠标悬停</button> <script> $(function () { $("[data-toggle='tooltip']").tooltip(); }); </script>
<!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 style="margin-left:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="left" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
"); window.frames["iframe3011"].document.write(decodeHtml(code3011)); window.frames["iframe3011"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3011"]).load(function(){ $("#iframe3011").height($("#iframe3011").contents().find("body").height()+showittryitheight); }); $("#iframe3011").height($("#iframe3011").contents().find("body").height()+showittryitheight); alreadyWriteCode3011 = code3011; $("#rendering3011").hide(); $("#rendered3011").show(); } var tRereshRetry2DemoPanel3011 = setInterval(rereshRetry2DemoPanel3011,1000); var binded3011 = false; $("textarea#stepcodeTextarea3011").keyup(function(){ if(!binded3011){ $(window).bind('beforeunload',function(){ binded3011 = true; return "xxxx"; }); } var newCode = $(this).val() code3011 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3011!=newCode){ // window.frames["iframe3011"].document.write("
"); // window.frames["iframe3011"].document.write(decodeHtml($("textarea#stepcodeTextarea3011").val())); // window.frames["iframe3011"].document.close(); // $(window.frames["iframe3011"]).load(function(){ // $("#iframe3011").height($("#iframe3011").contents().find("body").height()+showittryitheight); // }); // code3011 = newCode; // } }); $(".tryButton3011").click(function(){ $("#tryDiv3011").show(); $("#stepcodeTextarea3011").focus(); $("#stepcodeTextarea3011").height(200); $("#iframe3011").height(0); window.frames["iframe3011"].document.write("
"); window.frames["iframe3011"].document.write(decodeHtml($("textarea#stepcodeTextarea3011").val())); window.frames["iframe3011"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3011"]).load(function(){ $("#iframe3011").height($("#iframe3011").contents().find("body").height()+showittryitheight); }); $("#iframe3011").height($("#iframe3011").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3011.focus(); editor3011.setSize(null, "250"); $("#rendering3011").hide(); $("#rendered3011").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 editor3011 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3011"), { 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); } } }); editor3011.on("change",function(doc){ if(!binded3011){ $(window).bind('beforeunload',function(){ binded3011 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3011 = newCode; $("textarea#stepcodeTextarea3011").val(newCode); if(alreadyWriteCode3011!=code3011){ lastModifedTime3011 = new Date().getTime(); $("#rendering3011").show(); $("#rendered3011").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3011 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3011.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3011").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

右侧提示

右侧提示
"); window.frames["iframe_show3012"].document.write(decodeHtml($("textarea#stepcodeTextarea3012").val())); window.frames["iframe_show3012"].document.close(); $(window.frames["iframe_show3012"]).load(function(){ $("#iframe_show3012").height($("#iframe_show3012").contents().find("body").height()+showittryitheight); }); $("#iframe_show3012").height($("#iframe_show3012").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 style="margin-right:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="提示信息">鼠标悬停</button> <script> $(function () { $("[data-toggle='tooltip']").tooltip(); }); </script>
<!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 style="margin-right:100px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
"); window.frames["iframe3012"].document.write(decodeHtml(code3012)); window.frames["iframe3012"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3012"]).load(function(){ $("#iframe3012").height($("#iframe3012").contents().find("body").height()+showittryitheight); }); $("#iframe3012").height($("#iframe3012").contents().find("body").height()+showittryitheight); alreadyWriteCode3012 = code3012; $("#rendering3012").hide(); $("#rendered3012").show(); } var tRereshRetry2DemoPanel3012 = setInterval(rereshRetry2DemoPanel3012,1000); var binded3012 = false; $("textarea#stepcodeTextarea3012").keyup(function(){ if(!binded3012){ $(window).bind('beforeunload',function(){ binded3012 = true; return "xxxx"; }); } var newCode = $(this).val() code3012 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3012!=newCode){ // window.frames["iframe3012"].document.write("
"); // window.frames["iframe3012"].document.write(decodeHtml($("textarea#stepcodeTextarea3012").val())); // window.frames["iframe3012"].document.close(); // $(window.frames["iframe3012"]).load(function(){ // $("#iframe3012").height($("#iframe3012").contents().find("body").height()+showittryitheight); // }); // code3012 = newCode; // } }); $(".tryButton3012").click(function(){ $("#tryDiv3012").show(); $("#stepcodeTextarea3012").focus(); $("#stepcodeTextarea3012").height(200); $("#iframe3012").height(0); window.frames["iframe3012"].document.write("
"); window.frames["iframe3012"].document.write(decodeHtml($("textarea#stepcodeTextarea3012").val())); window.frames["iframe3012"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3012"]).load(function(){ $("#iframe3012").height($("#iframe3012").contents().find("body").height()+showittryitheight); }); $("#iframe3012").height($("#iframe3012").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3012.focus(); editor3012.setSize(null, "250"); $("#rendering3012").hide(); $("#rendered3012").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 editor3012 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3012"), { 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); } } }); editor3012.on("change",function(doc){ if(!binded3012){ $(window).bind('beforeunload',function(){ binded3012 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3012 = newCode; $("textarea#stepcodeTextarea3012").val(newCode); if(alreadyWriteCode3012!=code3012){ lastModifedTime3012 = new Date().getTime(); $("#rendering3012").show(); $("#rendered3012").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3012 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3012.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3012").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

上方提示

上方提示
"); window.frames["iframe_show3013"].document.write(decodeHtml($("textarea#stepcodeTextarea3013").val())); window.frames["iframe_show3013"].document.close(); $(window.frames["iframe_show3013"]).load(function(){ $("#iframe_show3013").height($("#iframe_show3013").contents().find("body").height()+showittryitheight); }); $("#iframe_show3013").height($("#iframe_show3013").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 style="margin-top:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="提示信息">鼠标悬停</button> <script> $(function () { $("[data-toggle='tooltip']").tooltip(); }); </script>
<!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 style="margin-top:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="top" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
"); window.frames["iframe3013"].document.write(decodeHtml(code3013)); window.frames["iframe3013"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3013"]).load(function(){ $("#iframe3013").height($("#iframe3013").contents().find("body").height()+showittryitheight); }); $("#iframe3013").height($("#iframe3013").contents().find("body").height()+showittryitheight); alreadyWriteCode3013 = code3013; $("#rendering3013").hide(); $("#rendered3013").show(); } var tRereshRetry2DemoPanel3013 = setInterval(rereshRetry2DemoPanel3013,1000); var binded3013 = false; $("textarea#stepcodeTextarea3013").keyup(function(){ if(!binded3013){ $(window).bind('beforeunload',function(){ binded3013 = true; return "xxxx"; }); } var newCode = $(this).val() code3013 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3013!=newCode){ // window.frames["iframe3013"].document.write("
"); // window.frames["iframe3013"].document.write(decodeHtml($("textarea#stepcodeTextarea3013").val())); // window.frames["iframe3013"].document.close(); // $(window.frames["iframe3013"]).load(function(){ // $("#iframe3013").height($("#iframe3013").contents().find("body").height()+showittryitheight); // }); // code3013 = newCode; // } }); $(".tryButton3013").click(function(){ $("#tryDiv3013").show(); $("#stepcodeTextarea3013").focus(); $("#stepcodeTextarea3013").height(200); $("#iframe3013").height(0); window.frames["iframe3013"].document.write("
"); window.frames["iframe3013"].document.write(decodeHtml($("textarea#stepcodeTextarea3013").val())); window.frames["iframe3013"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3013"]).load(function(){ $("#iframe3013").height($("#iframe3013").contents().find("body").height()+showittryitheight); }); $("#iframe3013").height($("#iframe3013").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3013.focus(); editor3013.setSize(null, "250"); $("#rendering3013").hide(); $("#rendered3013").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 editor3013 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3013"), { 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); } } }); editor3013.on("change",function(doc){ if(!binded3013){ $(window).bind('beforeunload',function(){ binded3013 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3013 = newCode; $("textarea#stepcodeTextarea3013").val(newCode); if(alreadyWriteCode3013!=code3013){ lastModifedTime3013 = new Date().getTime(); $("#rendering3013").show(); $("#rendered3013").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3013 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3013.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3013").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

下方提示

下方提示
"); window.frames["iframe_show3014"].document.write(decodeHtml($("textarea#stepcodeTextarea3014").val())); window.frames["iframe_show3014"].document.close(); $(window.frames["iframe_show3014"]).load(function(){ $("#iframe_show3014").height($("#iframe_show3014").contents().find("body").height()+showittryitheight); }); $("#iframe_show3014").height($("#iframe_show3014").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 style="margin-bottom:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="提示信息">鼠标悬停</button> <script> $(function () { $("[data-toggle='tooltip']").tooltip(); }); </script>
<!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 style="margin-bottom:50px" type="button" class="btn btn-default" data-toggle="tooltip" data-placement="bottom" title="提示信息">鼠标悬停</button>

<script>
   $(function () { $("[data-toggle='tooltip']").tooltip(); });
</script>
"); window.frames["iframe3014"].document.write(decodeHtml(code3014)); window.frames["iframe3014"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3014"]).load(function(){ $("#iframe3014").height($("#iframe3014").contents().find("body").height()+showittryitheight); }); $("#iframe3014").height($("#iframe3014").contents().find("body").height()+showittryitheight); alreadyWriteCode3014 = code3014; $("#rendering3014").hide(); $("#rendered3014").show(); } var tRereshRetry2DemoPanel3014 = setInterval(rereshRetry2DemoPanel3014,1000); var binded3014 = false; $("textarea#stepcodeTextarea3014").keyup(function(){ if(!binded3014){ $(window).bind('beforeunload',function(){ binded3014 = true; return "xxxx"; }); } var newCode = $(this).val() code3014 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3014!=newCode){ // window.frames["iframe3014"].document.write("
"); // window.frames["iframe3014"].document.write(decodeHtml($("textarea#stepcodeTextarea3014").val())); // window.frames["iframe3014"].document.close(); // $(window.frames["iframe3014"]).load(function(){ // $("#iframe3014").height($("#iframe3014").contents().find("body").height()+showittryitheight); // }); // code3014 = newCode; // } }); $(".tryButton3014").click(function(){ $("#tryDiv3014").show(); $("#stepcodeTextarea3014").focus(); $("#stepcodeTextarea3014").height(200); $("#iframe3014").height(0); window.frames["iframe3014"].document.write("
"); window.frames["iframe3014"].document.write(decodeHtml($("textarea#stepcodeTextarea3014").val())); window.frames["iframe3014"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3014"]).load(function(){ $("#iframe3014").height($("#iframe3014").contents().find("body").height()+showittryitheight); }); $("#iframe3014").height($("#iframe3014").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3014.focus(); editor3014.setSize(null, "250"); $("#rendering3014").hide(); $("#rendered3014").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 editor3014 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3014"), { 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); } } }); editor3014.on("change",function(doc){ if(!binded3014){ $(window).bind('beforeunload',function(){ binded3014 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3014 = newCode; $("textarea#stepcodeTextarea3014").val(newCode); if(alreadyWriteCode3014!=code3014){ lastModifedTime3014 = new Date().getTime(); $("#rendering3014").show(); $("#rendered3014").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3014 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3014.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3014").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

上传截图