");
window.frames["iframe_show365"].document.write(decodeHtml($("textarea#stepcodeTextarea365").val()));
window.frames["iframe_show365"].document.close();
$(window.frames["iframe_show365"]).load(function(){
$("#iframe_show365").height($("#iframe_show365").contents().find("body").height()+showittryitheight);
});
$("#iframe_show365").height($("#iframe_show365").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<p>今天晚上做什么?</p>
学习java<input type="checkbox" value="学习java" > <br/>
东京热<input type="checkbox" checked="checked" name="activity" value="tokyohot" > <br/>
dota<input type="checkbox" value="dota" > <br/>
LOL<input type="checkbox" value="lol"> <br/>
<p>今天晚上做什么?</p>
学习java<input type="checkbox" value="学习java" > <br/>
东京热<input type="checkbox" checked="checked" name="activity" value="tokyohot" > <br/>
dota<input type="checkbox" value="dota" > <br/>
LOL<input type="checkbox" value="lol"> <br/>
");
window.frames["iframe365"].document.write(decodeHtml(code365));
window.frames["iframe365"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe365"]).load(function(){
$("#iframe365").height($("#iframe365").contents().find("body").height()+showittryitheight);
});
$("#iframe365").height($("#iframe365").contents().find("body").height()+showittryitheight);
alreadyWriteCode365 = code365;
$("#rendering365").hide();
$("#rendered365").show();
}
var tRereshRetry2DemoPanel365 = setInterval(rereshRetry2DemoPanel365,1000);
var binded365 = false;
$("textarea#stepcodeTextarea365").keyup(function(){
if(!binded365){
$(window).bind('beforeunload',function(){
binded365 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code365 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code365!=newCode){
// window.frames["iframe365"].document.write("
");
// window.frames["iframe365"].document.write(decodeHtml($("textarea#stepcodeTextarea365").val()));
// window.frames["iframe365"].document.close();
// $(window.frames["iframe365"]).load(function(){
// $("#iframe365").height($("#iframe365").contents().find("body").height()+showittryitheight);
// });
// code365 = newCode;
// }
});
$(".tryButton365").click(function(){
$("#tryDiv365").show();
$("#stepcodeTextarea365").focus();
$("#stepcodeTextarea365").height(200);
$("#iframe365").height(0);
window.frames["iframe365"].document.write("
");
window.frames["iframe365"].document.write(decodeHtml($("textarea#stepcodeTextarea365").val()));
window.frames["iframe365"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe365"]).load(function(){
$("#iframe365").height($("#iframe365").contents().find("body").height()+showittryitheight);
});
$("#iframe365").height($("#iframe365").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor365.focus();
editor365.setSize(null, "250");
$("#rendering365").hide();
$("#rendered365").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 editor365 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea365"), {
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);
}
}
});
editor365.on("change",function(doc){
if(!binded365){
$(window).bind('beforeunload',function(){
binded365 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code365 = newCode;
$("textarea#stepcodeTextarea365").val(newCode);
if(alreadyWriteCode365!=code365){
lastModifedTime365 = new Date().getTime();
$("#rendering365").show();
$("#rendered365").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor365 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor365.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv365").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|