");
window.frames["iframe_show3946"].document.write(decodeHtml($("textarea#stepcodeTextarea3946").val()));
window.frames["iframe_show3946"].document.close();
$(window.frames["iframe_show3946"]).load(function(){
$("#iframe_show3946").height($("#iframe_show3946").contents().find("body").height()+showittryitheight);
});
$("#iframe_show3946").height($("#iframe_show3946").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<style>
.left{
width:200px;
float:left;
background-color:pink
}
.right{
width:200px;
float:right;
background-color:pink
}
.center {margin:0 200px; background-color:lightblue}
</style>
<div class="left">左边固定宽度</div>
<div class="right">左边固定宽度</div>
<div class="center">中间自适应</div>
</head>
<body>
</html>
<style>
.left{
width:200px;
float:left;
background-color:pink
}
.right{
width:200px;
float:right;
background-color:pink
}
.center {margin:0 200px; background-color:lightblue}
</style>
<div class="left">左边固定宽度</div>
<div class="right">左边固定宽度</div>
<div class="center">中间自适应</div>
</head>
<body>
</html>
");
window.frames["iframe3946"].document.write(decodeHtml(code3946));
window.frames["iframe3946"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3946"]).load(function(){
$("#iframe3946").height($("#iframe3946").contents().find("body").height()+showittryitheight);
});
$("#iframe3946").height($("#iframe3946").contents().find("body").height()+showittryitheight);
alreadyWriteCode3946 = code3946;
$("#rendering3946").hide();
$("#rendered3946").show();
}
var tRereshRetry2DemoPanel3946 = setInterval(rereshRetry2DemoPanel3946,1000);
var binded3946 = false;
$("textarea#stepcodeTextarea3946").keyup(function(){
if(!binded3946){
$(window).bind('beforeunload',function(){
binded3946 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code3946 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code3946!=newCode){
// window.frames["iframe3946"].document.write("
");
// window.frames["iframe3946"].document.write(decodeHtml($("textarea#stepcodeTextarea3946").val()));
// window.frames["iframe3946"].document.close();
// $(window.frames["iframe3946"]).load(function(){
// $("#iframe3946").height($("#iframe3946").contents().find("body").height()+showittryitheight);
// });
// code3946 = newCode;
// }
});
$(".tryButton3946").click(function(){
$("#tryDiv3946").show();
$("#stepcodeTextarea3946").focus();
$("#stepcodeTextarea3946").height(200);
$("#iframe3946").height(0);
window.frames["iframe3946"].document.write("
");
window.frames["iframe3946"].document.write(decodeHtml($("textarea#stepcodeTextarea3946").val()));
window.frames["iframe3946"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe3946"]).load(function(){
$("#iframe3946").height($("#iframe3946").contents().find("body").height()+showittryitheight);
});
$("#iframe3946").height($("#iframe3946").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor3946.focus();
editor3946.setSize(null, "250");
$("#rendering3946").hide();
$("#rendered3946").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 editor3946 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3946"), {
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);
}
}
});
editor3946.on("change",function(doc){
if(!binded3946){
$(window).bind('beforeunload',function(){
binded3946 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code3946 = newCode;
$("textarea#stepcodeTextarea3946").val(newCode);
if(alreadyWriteCode3946!=code3946){
lastModifedTime3946 = new Date().getTime();
$("#rendering3946").show();
$("#rendered3946").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor3946 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor3946.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv3946").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|