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)); });
效果 说明 示例代码
<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>
<style>
div{
  margin:5px;
}
</style>
<div class="input-group">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>

<div class="input-group">
  <input type="text" class="form-control" placeholder="邮箱" aria-describedby="basic-addon2">
  <span class="input-group-addon" id="basic-addon2">@12306.com</span>
</div>

<div class="input-group">
  <span class="input-group-addon">$</span>
  <input type="text" class="form-control"  placeholder="金额" aria-label="Amount (to the nearest dollar)">
  <span class="input-group-addon">.00</span>
</div>
基本组合
示例代码
<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>
<style>
div{
  margin:5px;
}
</style>
<div class="input-group input-group-lg">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
<div class="input-group input-group">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
<div class="input-group input-group-sm">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
尺寸
示例代码
<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>
<style>
div{
  margin:5px;
}
</style>

    <div class="input-group">
      <span class="input-group-addon">
        <input type="checkbox" >
      </span>
      <input type="text" class="form-control" >
    </div>
    <div class="input-group">
      <span class="input-group-addon">
        <input type="radio" >
      </span>
      <input type="text" class="form-control" >
    </div>

复选框和单选框
示例代码
<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>
<style>
div{
  margin:5px;
}
</style>

    <div class="input-group">
      <span class="input-group-btn">
        <button class="btn btn-default" type="button">搜索</button>
      </span>
      <input type="text" class="form-control" placeholder="Search for...">
    </div>

    <div class="input-group">
      <input type="text" class="form-control" placeholder="Search for...">
      <span class="input-group-btn">
        <button class="btn btn-default" type="button">搜索</button>
      </span>
    </div>
整合按钮
示例代码
<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>
<style>
div{
  margin:5px;
}
</style>
    <div class="input-group">
      <div class="input-group-btn">
        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">搜索<span class="caret"></span></button>
        <ul class="dropdown-menu" role="menu">
          <li><a href="#">Google</a></li>
          <li><a href="#">百度</a></li>
          <li><a href="#">搜狗</a></li>
          <li class="divider"></li>
          <li><a href="#">人民搜索</a></li>
        </ul>
      </div>
      <input type="text" class="form-control" aria-label="...">
    </div>

    <div class="input-group">
      <input type="text" class="form-control" aria-label="...">
      <div class="input-group-btn">
        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">搜索<span class="caret"></span></button>
        <ul class="dropdown-menu dropdown-menu-right" role="menu">
          <li><a href="#">Google</a></li>
          <li><a href="#">百度</a></li>
          <li><a href="#">搜狗</a></li>
          <li class="divider"></li>
          <li><a href="#">人民搜索</a></li>
        </ul>
      </div>
    </div>

<div style="height:120px"></div>
整合下拉菜单
示例代码
<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>
<style>
div{
  margin:5px;
}
</style>
<div class="input-group">
  <input type="text" class="form-control" aria-label="...">
  <div class="input-group-btn">
<button type="button" class="btn btn-default">提交</button>
   <button type="button" class="btn btn-default dropdown-toggle"
      data-toggle="dropdown">
      <span class="caret"></span>
 
   </button>
   <ul class="dropdown-menu" role="menu">
     <li>
         <a href="#">HTML</a>             
      </li>
      <li role="presentation">
         <a href="#">CSS</a>              
      </li>
  
      <li role="presentation">
         <a href="#">Javascript</a>           
      </li>
      <li role="presentation">
         <a href="#">AJAX</a>             
      </li>
   </ul>
  </div>
</div>
<div style="height:120px"></div>
整合分裂式下拉菜单
示例代码
示例 1 : 基本组合   
示例 2 : 尺寸   
示例 3 : 复选框和单选框   
示例 4 : 整合按钮   
示例 5 : 整合下拉菜单   
示例 6 : 整合分裂式下拉菜单   

示例 1 :

基本组合

基本组合
"); window.frames["iframe_show2913"].document.write(decodeHtml($("textarea#stepcodeTextarea2913").val())); window.frames["iframe_show2913"].document.close(); $(window.frames["iframe_show2913"]).load(function(){ $("#iframe_show2913").height($("#iframe_show2913").contents().find("body").height()+showittryitheight); }); $("#iframe_show2913").height($("#iframe_show2913").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1"> </div> <div class="input-group"> <input type="text" class="form-control" placeholder="邮箱" aria-describedby="basic-addon2"> <span class="input-group-addon" id="basic-addon2">@12306.com</span> </div> <div class="input-group"> <span class="input-group-addon">$</span> <input type="text" class="form-control" placeholder="金额" aria-label="Amount (to the nearest dollar)"> <span class="input-group-addon">.00</span> </div>
"); window.frames["iframe2913"].document.write(decodeHtml(code2913)); window.frames["iframe2913"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2913"]).load(function(){ $("#iframe2913").height($("#iframe2913").contents().find("body").height()+showittryitheight); }); $("#iframe2913").height($("#iframe2913").contents().find("body").height()+showittryitheight); alreadyWriteCode2913 = code2913; $("#rendering2913").hide(); $("#rendered2913").show(); } var tRereshRetry2DemoPanel2913 = setInterval(rereshRetry2DemoPanel2913,1000); var binded2913 = false; $("textarea#stepcodeTextarea2913").keyup(function(){ if(!binded2913){ $(window).bind('beforeunload',function(){ binded2913 = true; return "xxxx"; }); } var newCode = $(this).val() code2913 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2913!=newCode){ // window.frames["iframe2913"].document.write("
"); // window.frames["iframe2913"].document.write(decodeHtml($("textarea#stepcodeTextarea2913").val())); // window.frames["iframe2913"].document.close(); // $(window.frames["iframe2913"]).load(function(){ // $("#iframe2913").height($("#iframe2913").contents().find("body").height()+showittryitheight); // }); // code2913 = newCode; // } }); $(".tryButton2913").click(function(){ $("#tryDiv2913").show(); $("#stepcodeTextarea2913").focus(); $("#stepcodeTextarea2913").height(200); $("#iframe2913").height(0); window.frames["iframe2913"].document.write("
"); window.frames["iframe2913"].document.write(decodeHtml($("textarea#stepcodeTextarea2913").val())); window.frames["iframe2913"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2913"]).load(function(){ $("#iframe2913").height($("#iframe2913").contents().find("body").height()+showittryitheight); }); $("#iframe2913").height($("#iframe2913").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2913.focus(); editor2913.setSize(null, "250"); $("#rendering2913").hide(); $("#rendered2913").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 editor2913 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2913"), { 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); } } }); editor2913.on("change",function(doc){ if(!binded2913){ $(window).bind('beforeunload',function(){ binded2913 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2913 = newCode; $("textarea#stepcodeTextarea2913").val(newCode); if(alreadyWriteCode2913!=code2913){ lastModifedTime2913 = new Date().getTime(); $("#rendering2913").show(); $("#rendered2913").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2913 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2913.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2913").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

尺寸

尺寸
"); window.frames["iframe_show2914"].document.write(decodeHtml($("textarea#stepcodeTextarea2914").val())); window.frames["iframe_show2914"].document.close(); $(window.frames["iframe_show2914"]).load(function(){ $("#iframe_show2914").height($("#iframe_show2914").contents().find("body").height()+showittryitheight); }); $("#iframe_show2914").height($("#iframe_show2914").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group input-group-lg"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1"> </div> <div class="input-group input-group"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1"> </div> <div class="input-group input-group-sm"> <span class="input-group-addon" id="basic-addon1">@</span> <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1"> </div>
<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>
<style>
div{
  margin:5px;
}
</style>
<div class="input-group input-group-lg">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
<div class="input-group input-group">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
<div class="input-group input-group-sm">
  <span class="input-group-addon" id="basic-addon1">@</span>
  <input type="text" class="form-control" placeholder="用户名" aria-describedby="basic-addon1">
</div>
"); window.frames["iframe2914"].document.write(decodeHtml(code2914)); window.frames["iframe2914"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2914"]).load(function(){ $("#iframe2914").height($("#iframe2914").contents().find("body").height()+showittryitheight); }); $("#iframe2914").height($("#iframe2914").contents().find("body").height()+showittryitheight); alreadyWriteCode2914 = code2914; $("#rendering2914").hide(); $("#rendered2914").show(); } var tRereshRetry2DemoPanel2914 = setInterval(rereshRetry2DemoPanel2914,1000); var binded2914 = false; $("textarea#stepcodeTextarea2914").keyup(function(){ if(!binded2914){ $(window).bind('beforeunload',function(){ binded2914 = true; return "xxxx"; }); } var newCode = $(this).val() code2914 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2914!=newCode){ // window.frames["iframe2914"].document.write("
"); // window.frames["iframe2914"].document.write(decodeHtml($("textarea#stepcodeTextarea2914").val())); // window.frames["iframe2914"].document.close(); // $(window.frames["iframe2914"]).load(function(){ // $("#iframe2914").height($("#iframe2914").contents().find("body").height()+showittryitheight); // }); // code2914 = newCode; // } }); $(".tryButton2914").click(function(){ $("#tryDiv2914").show(); $("#stepcodeTextarea2914").focus(); $("#stepcodeTextarea2914").height(200); $("#iframe2914").height(0); window.frames["iframe2914"].document.write("
"); window.frames["iframe2914"].document.write(decodeHtml($("textarea#stepcodeTextarea2914").val())); window.frames["iframe2914"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2914"]).load(function(){ $("#iframe2914").height($("#iframe2914").contents().find("body").height()+showittryitheight); }); $("#iframe2914").height($("#iframe2914").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2914.focus(); editor2914.setSize(null, "250"); $("#rendering2914").hide(); $("#rendered2914").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 editor2914 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2914"), { 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); } } }); editor2914.on("change",function(doc){ if(!binded2914){ $(window).bind('beforeunload',function(){ binded2914 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2914 = newCode; $("textarea#stepcodeTextarea2914").val(newCode); if(alreadyWriteCode2914!=code2914){ lastModifedTime2914 = new Date().getTime(); $("#rendering2914").show(); $("#rendered2914").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2914 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2914.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2914").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

复选框和单选框

复选框和单选框
"); window.frames["iframe_show2915"].document.write(decodeHtml($("textarea#stepcodeTextarea2915").val())); window.frames["iframe_show2915"].document.close(); $(window.frames["iframe_show2915"]).load(function(){ $("#iframe_show2915").height($("#iframe_show2915").contents().find("body").height()+showittryitheight); }); $("#iframe_show2915").height($("#iframe_show2915").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group"> <span class="input-group-addon"> <input type="checkbox" > </span> <input type="text" class="form-control" > </div> <div class="input-group"> <span class="input-group-addon"> <input type="radio" > </span> <input type="text" class="form-control" > </div>
"); window.frames["iframe2915"].document.write(decodeHtml(code2915)); window.frames["iframe2915"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2915"]).load(function(){ $("#iframe2915").height($("#iframe2915").contents().find("body").height()+showittryitheight); }); $("#iframe2915").height($("#iframe2915").contents().find("body").height()+showittryitheight); alreadyWriteCode2915 = code2915; $("#rendering2915").hide(); $("#rendered2915").show(); } var tRereshRetry2DemoPanel2915 = setInterval(rereshRetry2DemoPanel2915,1000); var binded2915 = false; $("textarea#stepcodeTextarea2915").keyup(function(){ if(!binded2915){ $(window).bind('beforeunload',function(){ binded2915 = true; return "xxxx"; }); } var newCode = $(this).val() code2915 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2915!=newCode){ // window.frames["iframe2915"].document.write("
"); // window.frames["iframe2915"].document.write(decodeHtml($("textarea#stepcodeTextarea2915").val())); // window.frames["iframe2915"].document.close(); // $(window.frames["iframe2915"]).load(function(){ // $("#iframe2915").height($("#iframe2915").contents().find("body").height()+showittryitheight); // }); // code2915 = newCode; // } }); $(".tryButton2915").click(function(){ $("#tryDiv2915").show(); $("#stepcodeTextarea2915").focus(); $("#stepcodeTextarea2915").height(200); $("#iframe2915").height(0); window.frames["iframe2915"].document.write("
"); window.frames["iframe2915"].document.write(decodeHtml($("textarea#stepcodeTextarea2915").val())); window.frames["iframe2915"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2915"]).load(function(){ $("#iframe2915").height($("#iframe2915").contents().find("body").height()+showittryitheight); }); $("#iframe2915").height($("#iframe2915").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2915.focus(); editor2915.setSize(null, "250"); $("#rendering2915").hide(); $("#rendered2915").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 editor2915 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2915"), { 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); } } }); editor2915.on("change",function(doc){ if(!binded2915){ $(window).bind('beforeunload',function(){ binded2915 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2915 = newCode; $("textarea#stepcodeTextarea2915").val(newCode); if(alreadyWriteCode2915!=code2915){ lastModifedTime2915 = new Date().getTime(); $("#rendering2915").show(); $("#rendered2915").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2915 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2915.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2915").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

整合按钮

整合按钮
"); window.frames["iframe_show2916"].document.write(decodeHtml($("textarea#stepcodeTextarea2916").val())); window.frames["iframe_show2916"].document.close(); $(window.frames["iframe_show2916"]).load(function(){ $("#iframe_show2916").height($("#iframe_show2916").contents().find("body").height()+showittryitheight); }); $("#iframe_show2916").height($("#iframe_show2916").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group"> <span class="input-group-btn"> <button class="btn btn-default" type="button">搜索</button> </span> <input type="text" class="form-control" placeholder="Search for..."> </div> <div class="input-group"> <input type="text" class="form-control" placeholder="Search for..."> <span class="input-group-btn"> <button class="btn btn-default" type="button">搜索</button> </span> </div>
"); window.frames["iframe2916"].document.write(decodeHtml(code2916)); window.frames["iframe2916"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2916"]).load(function(){ $("#iframe2916").height($("#iframe2916").contents().find("body").height()+showittryitheight); }); $("#iframe2916").height($("#iframe2916").contents().find("body").height()+showittryitheight); alreadyWriteCode2916 = code2916; $("#rendering2916").hide(); $("#rendered2916").show(); } var tRereshRetry2DemoPanel2916 = setInterval(rereshRetry2DemoPanel2916,1000); var binded2916 = false; $("textarea#stepcodeTextarea2916").keyup(function(){ if(!binded2916){ $(window).bind('beforeunload',function(){ binded2916 = true; return "xxxx"; }); } var newCode = $(this).val() code2916 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2916!=newCode){ // window.frames["iframe2916"].document.write("
"); // window.frames["iframe2916"].document.write(decodeHtml($("textarea#stepcodeTextarea2916").val())); // window.frames["iframe2916"].document.close(); // $(window.frames["iframe2916"]).load(function(){ // $("#iframe2916").height($("#iframe2916").contents().find("body").height()+showittryitheight); // }); // code2916 = newCode; // } }); $(".tryButton2916").click(function(){ $("#tryDiv2916").show(); $("#stepcodeTextarea2916").focus(); $("#stepcodeTextarea2916").height(200); $("#iframe2916").height(0); window.frames["iframe2916"].document.write("
"); window.frames["iframe2916"].document.write(decodeHtml($("textarea#stepcodeTextarea2916").val())); window.frames["iframe2916"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2916"]).load(function(){ $("#iframe2916").height($("#iframe2916").contents().find("body").height()+showittryitheight); }); $("#iframe2916").height($("#iframe2916").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2916.focus(); editor2916.setSize(null, "250"); $("#rendering2916").hide(); $("#rendered2916").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 editor2916 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2916"), { 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); } } }); editor2916.on("change",function(doc){ if(!binded2916){ $(window).bind('beforeunload',function(){ binded2916 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2916 = newCode; $("textarea#stepcodeTextarea2916").val(newCode); if(alreadyWriteCode2916!=code2916){ lastModifedTime2916 = new Date().getTime(); $("#rendering2916").show(); $("#rendered2916").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2916 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2916.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2916").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

整合下拉菜单

整合下拉菜单
"); window.frames["iframe_show2917"].document.write(decodeHtml($("textarea#stepcodeTextarea2917").val())); window.frames["iframe_show2917"].document.close(); $(window.frames["iframe_show2917"]).load(function(){ $("#iframe_show2917").height($("#iframe_show2917").contents().find("body").height()+showittryitheight); }); $("#iframe_show2917").height($("#iframe_show2917").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group"> <div class="input-group-btn"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">搜索<span class="caret"></span></button> <ul class="dropdown-menu" role="menu"> <li><a href="#">Google</a></li> <li><a href="#">百度</a></li> <li><a href="#">搜狗</a></li> <li class="divider"></li> <li><a href="#">人民搜索</a></li> </ul> </div> <input type="text" class="form-control" aria-label="..."> </div> <div class="input-group"> <input type="text" class="form-control" aria-label="..."> <div class="input-group-btn"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">搜索<span class="caret"></span></button> <ul class="dropdown-menu dropdown-menu-right" role="menu"> <li><a href="#">Google</a></li> <li><a href="#">百度</a></li> <li><a href="#">搜狗</a></li> <li class="divider"></li> <li><a href="#">人民搜索</a></li> </ul> </div> </div> <div style="height:120px"></div>
"); window.frames["iframe2917"].document.write(decodeHtml(code2917)); window.frames["iframe2917"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2917"]).load(function(){ $("#iframe2917").height($("#iframe2917").contents().find("body").height()+showittryitheight); }); $("#iframe2917").height($("#iframe2917").contents().find("body").height()+showittryitheight); alreadyWriteCode2917 = code2917; $("#rendering2917").hide(); $("#rendered2917").show(); } var tRereshRetry2DemoPanel2917 = setInterval(rereshRetry2DemoPanel2917,1000); var binded2917 = false; $("textarea#stepcodeTextarea2917").keyup(function(){ if(!binded2917){ $(window).bind('beforeunload',function(){ binded2917 = true; return "xxxx"; }); } var newCode = $(this).val() code2917 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2917!=newCode){ // window.frames["iframe2917"].document.write("
"); // window.frames["iframe2917"].document.write(decodeHtml($("textarea#stepcodeTextarea2917").val())); // window.frames["iframe2917"].document.close(); // $(window.frames["iframe2917"]).load(function(){ // $("#iframe2917").height($("#iframe2917").contents().find("body").height()+showittryitheight); // }); // code2917 = newCode; // } }); $(".tryButton2917").click(function(){ $("#tryDiv2917").show(); $("#stepcodeTextarea2917").focus(); $("#stepcodeTextarea2917").height(200); $("#iframe2917").height(0); window.frames["iframe2917"].document.write("
"); window.frames["iframe2917"].document.write(decodeHtml($("textarea#stepcodeTextarea2917").val())); window.frames["iframe2917"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2917"]).load(function(){ $("#iframe2917").height($("#iframe2917").contents().find("body").height()+showittryitheight); }); $("#iframe2917").height($("#iframe2917").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2917.focus(); editor2917.setSize(null, "250"); $("#rendering2917").hide(); $("#rendered2917").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 editor2917 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2917"), { 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); } } }); editor2917.on("change",function(doc){ if(!binded2917){ $(window).bind('beforeunload',function(){ binded2917 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2917 = newCode; $("textarea#stepcodeTextarea2917").val(newCode); if(alreadyWriteCode2917!=code2917){ lastModifedTime2917 = new Date().getTime(); $("#rendering2917").show(); $("#rendered2917").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2917 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2917.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2917").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

整合分裂式下拉菜单

整合分裂式下拉菜单
"); window.frames["iframe_show2918"].document.write(decodeHtml($("textarea#stepcodeTextarea2918").val())); window.frames["iframe_show2918"].document.close(); $(window.frames["iframe_show2918"]).load(function(){ $("#iframe_show2918").height($("#iframe_show2918").contents().find("body").height()+showittryitheight); }); $("#iframe_show2918").height($("#iframe_show2918").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
运行效果
<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> <style> div{ margin:5px; } </style> <div class="input-group"> <input type="text" class="form-control" aria-label="..."> <div class="input-group-btn"> <button type="button" class="btn btn-default">提交</button> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu" role="menu"> <li> <a href="#">HTML</a> </li> <li role="presentation"> <a href="#">CSS</a> </li> <li role="presentation"> <a href="#">Javascript</a> </li> <li role="presentation"> <a href="#">AJAX</a> </li> </ul> </div> </div> <div style="height:120px"></div>
"); window.frames["iframe2918"].document.write(decodeHtml(code2918)); window.frames["iframe2918"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2918"]).load(function(){ $("#iframe2918").height($("#iframe2918").contents().find("body").height()+showittryitheight); }); $("#iframe2918").height($("#iframe2918").contents().find("body").height()+showittryitheight); alreadyWriteCode2918 = code2918; $("#rendering2918").hide(); $("#rendered2918").show(); } var tRereshRetry2DemoPanel2918 = setInterval(rereshRetry2DemoPanel2918,1000); var binded2918 = false; $("textarea#stepcodeTextarea2918").keyup(function(){ if(!binded2918){ $(window).bind('beforeunload',function(){ binded2918 = true; return "xxxx"; }); } var newCode = $(this).val() code2918 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code2918!=newCode){ // window.frames["iframe2918"].document.write("
"); // window.frames["iframe2918"].document.write(decodeHtml($("textarea#stepcodeTextarea2918").val())); // window.frames["iframe2918"].document.close(); // $(window.frames["iframe2918"]).load(function(){ // $("#iframe2918").height($("#iframe2918").contents().find("body").height()+showittryitheight); // }); // code2918 = newCode; // } }); $(".tryButton2918").click(function(){ $("#tryDiv2918").show(); $("#stepcodeTextarea2918").focus(); $("#stepcodeTextarea2918").height(200); $("#iframe2918").height(0); window.frames["iframe2918"].document.write("
"); window.frames["iframe2918"].document.write(decodeHtml($("textarea#stepcodeTextarea2918").val())); window.frames["iframe2918"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe2918"]).load(function(){ $("#iframe2918").height($("#iframe2918").contents().find("body").height()+showittryitheight); }); $("#iframe2918").height($("#iframe2918").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor2918.focus(); editor2918.setSize(null, "250"); $("#rendering2918").hide(); $("#rendered2918").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 editor2918 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2918"), { 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); } } }); editor2918.on("change",function(doc){ if(!binded2918){ $(window).bind('beforeunload',function(){ binded2918 = true; return "xxxx"; }); } var newCode = doc.getValue(); code2918 = newCode; $("textarea#stepcodeTextarea2918").val(newCode); if(alreadyWriteCode2918!=code2918){ lastModifedTime2918 = new Date().getTime(); $("#rendering2918").show(); $("#rendered2918").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor2918 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor2918.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv2918").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

上传截图