how2j.cn


6分8秒
本视频采用html5方式播放,如无法正常播放,请将浏览器升级至最新版本,推荐火狐,chrome,360浏览器 如果装有迅雷,播放视频呈现直接下载状态,请调整 迅雷系统设置-基本设置-启动-监视全部浏览器 (去掉这个选项)

步骤 1 : 效果   
步骤 2 : 布局   
步骤 3 : 纯html   
步骤 4 : 加上样式   
步骤 5 : 样式讲解   
步骤 6 : 再整合在一起   

步骤 1 :

效果

"); window.frames["iframe_show3214"].document.write(decodeHtml($("textarea#stepcodeTextarea3214").val())); window.frames["iframe_show3214"].document.close(); $(window.frames["iframe_show3214"]).load(function(){ $("#iframe_show3214").height($("#iframe_show3214").contents().find("body").height()+showittryitheight); }); $("#iframe_show3214").height($("#iframe_show3214").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <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> </head> <style> div.categoryPageDiv{ max-width: 1013px; margin: 10px auto; } div.categorySortBar{ background-color: #FAF9F9; margin: 40px 20px 20px 20px; padding: 4px; } table.categorySortBarTable{ border-collapse: collapse; display:inline-block; } table.categorySortBarTable span.glyphicon{ font-size: 10px; } table.categorySortBarTable td{ height:17px; font-size:12px; border:1px solid #CCCCCC; padding:3px; } table.categorySortBarTable td.grayColumn{ background-color: #F1EDEC; } table.categorySortBarTable td a{ color: #806F66; } table.categorySortBarTable td a:hover{ color: #C40000; } table.categorySortBarTable input{ border-width: 0px; height: 15px; width: 50px; } table.categorySortBarTable td.priceMiddleColumn{ width: 5px; vertical-align: middle; color: #CCCCCC; } table.categorySortTable td:hover{ background-color: #F1EDEC; } body{ font-size: 12px ; font-family: Arial; } </style> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <div class="categoryPageDiv"> <img src="http://127.0.0.1/tmall/img/category/72.jpg"> <div class="categorySortBar"> <table class="categorySortBarTable categorySortTable"> <tbody><tr> <td class="grayColumn"><a href="#nowhere">综合<span class="glyphicon glyphicon-arrow-down"></span></a></td> <td><a href="#nowhere">人气<span class="glyphicon glyphicon-arrow-down"></span></a></td> <td><a href="#nowhere">新品<span class="glyphicon glyphicon-arrow-down"></span></a></td> <td><a href="#nowhere">销量<span class="glyphicon glyphicon-arrow-down"></span></a></td> <td><a href="#nowhere">价格<span class="glyphicon glyphicon-resize-vertical"></span></a></td> </tr> </tbody></table> <table class="categorySortBarTable"> <tbody><tr> <td><input type="text" placeholder="请输入" class="sortBarPrice beginPrice"></td> <td class="grayColumn priceMiddleColumn">-</td> <td><input type="text" placeholder="请输入" class="sortBarPrice endPrice"></td> </tr> </tbody></table> </div> </div>
"); window.frames["iframe3214"].document.write(decodeHtml(code3214)); window.frames["iframe3214"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3214"]).load(function(){ $("#iframe3214").height($("#iframe3214").contents().find("body").height()+showittryitheight); }); $("#iframe3214").height($("#iframe3214").contents().find("body").height()+showittryitheight); alreadyWriteCode3214 = code3214; $("#rendering3214").hide(); $("#rendered3214").show(); } var tRereshRetry2DemoPanel3214 = setInterval(rereshRetry2DemoPanel3214,1000); var binded3214 = false; $("textarea#stepcodeTextarea3214").keyup(function(){ if(!binded3214){ $(window).bind('beforeunload',function(){ binded3214 = true; return "xxxx"; }); } var newCode = $(this).val() code3214 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3214!=newCode){ // window.frames["iframe3214"].document.write("
"); // window.frames["iframe3214"].document.write(decodeHtml($("textarea#stepcodeTextarea3214").val())); // window.frames["iframe3214"].document.close(); // $(window.frames["iframe3214"]).load(function(){ // $("#iframe3214").height($("#iframe3214").contents().find("body").height()+showittryitheight); // }); // code3214 = newCode; // } }); $(".tryButton3214").click(function(){ $("#tryDiv3214").show(); $("#stepcodeTextarea3214").focus(); $("#stepcodeTextarea3214").height(200); $("#iframe3214").height(0); window.frames["iframe3214"].document.write("
"); window.frames["iframe3214"].document.write(decodeHtml($("textarea#stepcodeTextarea3214").val())); window.frames["iframe3214"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3214"]).load(function(){ $("#iframe3214").height($("#iframe3214").contents().find("body").height()+showittryitheight); }); $("#iframe3214").height($("#iframe3214").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3214.focus(); editor3214.setSize(null, "250"); $("#rendering3214").hide(); $("#rendered3214").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 editor3214 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3214"), { 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); } } }); editor3214.on("change",function(doc){ if(!binded3214){ $(window).bind('beforeunload',function(){ binded3214 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3214 = newCode; $("textarea#stepcodeTextarea3214").val(newCode); if(alreadyWriteCode3214!=code3214){ lastModifedTime3214 = new Date().getTime(); $("#rendering3214").show(); $("#rendered3214").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3214 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3214.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3214").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


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

布局

增值内容,请先登录
步骤 3 :

纯html

增值内容,请先登录
步骤 4 :

加上样式

增值内容,请先登录
步骤 5 :

样式讲解

增值内容,请先登录
步骤 6 :

再整合在一起

增值内容,请先登录


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


关于 实践项目-天猫前端-排序和价格 的提问

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

上传截图