");
window.frames["iframe_show2999"].document.write(decodeHtml($("textarea#stepcodeTextarea2999").val()));
window.frames["iframe_show2999"].document.close();
$(window.frames["iframe_show2999"]).load(function(){
$("#iframe_show2999").height($("#iframe_show2999").contents().find("body").height()+showittryitheight);
});
$("#iframe_show2999").height($("#iframe_show2999").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>
<div class="well">文字呈现嵌入效果</div>
<!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>
<div class="well">文字呈现嵌入效果</div>
");
window.frames["iframe2999"].document.write(decodeHtml(code2999));
window.frames["iframe2999"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2999"]).load(function(){
$("#iframe2999").height($("#iframe2999").contents().find("body").height()+showittryitheight);
});
$("#iframe2999").height($("#iframe2999").contents().find("body").height()+showittryitheight);
alreadyWriteCode2999 = code2999;
$("#rendering2999").hide();
$("#rendered2999").show();
}
var tRereshRetry2DemoPanel2999 = setInterval(rereshRetry2DemoPanel2999,1000);
var binded2999 = false;
$("textarea#stepcodeTextarea2999").keyup(function(){
if(!binded2999){
$(window).bind('beforeunload',function(){
binded2999 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code2999 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code2999!=newCode){
// window.frames["iframe2999"].document.write("
");
// window.frames["iframe2999"].document.write(decodeHtml($("textarea#stepcodeTextarea2999").val()));
// window.frames["iframe2999"].document.close();
// $(window.frames["iframe2999"]).load(function(){
// $("#iframe2999").height($("#iframe2999").contents().find("body").height()+showittryitheight);
// });
// code2999 = newCode;
// }
});
$(".tryButton2999").click(function(){
$("#tryDiv2999").show();
$("#stepcodeTextarea2999").focus();
$("#stepcodeTextarea2999").height(200);
$("#iframe2999").height(0);
window.frames["iframe2999"].document.write("
");
window.frames["iframe2999"].document.write(decodeHtml($("textarea#stepcodeTextarea2999").val()));
window.frames["iframe2999"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe2999"]).load(function(){
$("#iframe2999").height($("#iframe2999").contents().find("body").height()+showittryitheight);
});
$("#iframe2999").height($("#iframe2999").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor2999.focus();
editor2999.setSize(null, "250");
$("#rendering2999").hide();
$("#rendered2999").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 editor2999 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea2999"), {
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);
}
}
});
editor2999.on("change",function(doc){
if(!binded2999){
$(window).bind('beforeunload',function(){
binded2999 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code2999 = newCode;
$("textarea#stepcodeTextarea2999").val(newCode);
if(alreadyWriteCode2999!=code2999){
lastModifedTime2999 = new Date().getTime();
$("#rendering2999").show();
$("#rendered2999").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor2999 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor2999.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv2999").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|