并不是所有的搜索页面都和主页的那个一样。 比如在
天猫注册页面,使用的搜索页面就是一个相对简单点的搜索页面,这个页面也会被不同的页面所包含
");
window.frames["iframe_show3159"].document.write(decodeHtml($("textarea#stepcodeTextarea3159").val()));
window.frames["iframe_show3159"].document.close();
$(window.frames["iframe_show3159"]).load(function(){
$("#iframe_show3159").height($("#iframe_show3159").contents().find("body").height()+showittryitheight);
});
$("#iframe_show3159").height($("#iframe_show3159").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.simpleSearchDiv{
background-color: #C40000;
width: 300px;
margin: 10px 20px 40px;
padding: 1px;
height: 40px;
display: block;
}
div.simpleSearchDiv input{
width: 225px;
border: 1px solid transparent;
height: 34px;
margin: 2px;
outline:none;
}
div.simpleSearchDiv button{
width: 60px;
border: 1px solid transparent;
background-color: #C40000;
color: white;
font-size: 14px;
/* font-weight:bold */;
}
div.searchBelow{
margin-top: 3px;
margin-left: -20px;
}
div.searchBelow span{
color: #999;
}
div.searchBelow a{
padding: 0px 20px 0px 20px;
font-size: 14px;
}
img.simpleLogo{
position: absolute;
left: 10px;
top: 50px;
width: 140px;
}
body{
font-size: 12px;
font-family: Arial;
}
a{
color:#999;
}
a:hover{
text-decoration:none;
color: #C40000;
}
</style>
<div>
<a href="#nowhere">
<img src="http://127.0.0.1/tmall../../../img/site/simpleLogo.png" class="simpleLogo" id="simpleLogo">
</a>
<div class="simpleSearchDiv pull-right">
<input type="text" name="keyword" placeholder="平衡车 原汁机">
<button type="button" class="searchButton">搜天猫</button>
<div class="searchBelow">
<span>
<a href="#nowhere">
冰箱
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
空调
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
女表
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
男表
</a>
</span>
</div>
</div>
<div style="clear:both"></div>
</div>
<!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.simpleSearchDiv{
background-color: #C40000;
width: 300px;
margin: 10px 20px 40px;
padding: 1px;
height: 40px;
display: block;
}
div.simpleSearchDiv input{
width: 225px;
border: 1px solid transparent;
height: 34px;
margin: 2px;
outline:none;
}
div.simpleSearchDiv button{
width: 60px;
border: 1px solid transparent;
background-color: #C40000;
color: white;
font-size: 14px;
/* font-weight:bold */;
}
div.searchBelow{
margin-top: 3px;
margin-left: -20px;
}
div.searchBelow span{
color: #999;
}
div.searchBelow a{
padding: 0px 20px 0px 20px;
font-size: 14px;
}
img.simpleLogo{
position: absolute;
left: 10px;
top: 50px;
width: 140px;
}
body{
font-size: 12px;
font-family: Arial;
}
a{
color:#999;
}
a:hover{
text-decoration:none;
color: #C40000;
}
</style>
<div>
<a href="#nowhere">
<img src="http://127.0.0.1/tmall../../../img/site/simpleLogo.png" class="simpleLogo" id="simpleLogo">
</a>
<div class="simpleSearchDiv pull-right">
<input type="text" name="keyword" placeholder="平衡车 原汁机">
<button type="button" class="searchButton">搜天猫</button>
<div class="searchBelow">
<span>
<a href="#nowhere">
冰箱
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
空调
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
女表
</a>
<span>|</span>
</span>
<span>
<a href="#nowhere">
男表
</a>
</span>
</div>
</div>
<div style="clear:both"></div>
</div>
");
window.frames["iframe3159"].document.write(decodeHtml(code3159));
window.frames["iframe3159"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3159"]).load(function(){
$("#iframe3159").height($("#iframe3159").contents().find("body").height()+showittryitheight);
});
$("#iframe3159").height($("#iframe3159").contents().find("body").height()+showittryitheight);
alreadyWriteCode3159 = code3159;
$("#rendering3159").hide();
$("#rendered3159").show();
}
var tRereshRetry2DemoPanel3159 = setInterval(rereshRetry2DemoPanel3159,1000);
var binded3159 = false;
$("textarea#stepcodeTextarea3159").keyup(function(){
if(!binded3159){
$(window).bind('beforeunload',function(){
binded3159 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code3159 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code3159!=newCode){
// window.frames["iframe3159"].document.write("
");
// window.frames["iframe3159"].document.write(decodeHtml($("textarea#stepcodeTextarea3159").val()));
// window.frames["iframe3159"].document.close();
// $(window.frames["iframe3159"]).load(function(){
// $("#iframe3159").height($("#iframe3159").contents().find("body").height()+showittryitheight);
// });
// code3159 = newCode;
// }
});
$(".tryButton3159").click(function(){
$("#tryDiv3159").show();
$("#stepcodeTextarea3159").focus();
$("#stepcodeTextarea3159").height(200);
$("#iframe3159").height(0);
window.frames["iframe3159"].document.write("
");
window.frames["iframe3159"].document.write(decodeHtml($("textarea#stepcodeTextarea3159").val()));
window.frames["iframe3159"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3159"]).load(function(){
$("#iframe3159").height($("#iframe3159").contents().find("body").height()+showittryitheight);
});
$("#iframe3159").height($("#iframe3159").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor3159.focus();
editor3159.setSize(null, "250");
$("#rendering3159").hide();
$("#rendered3159").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 editor3159 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3159"), {
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);
}
}
});
editor3159.on("change",function(doc){
if(!binded3159){
$(window).bind('beforeunload',function(){
binded3159 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code3159 = newCode;
$("textarea#stepcodeTextarea3159").val(newCode);
if(alreadyWriteCode3159!=code3159){
lastModifedTime3159 = new Date().getTime();
$("#rendering3159").show();
$("#rendered3159").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor3159 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor3159.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv3159").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|