");
window.frames["iframe_show379"].document.write(decodeHtml($("textarea#stepcodeTextarea379").val()));
window.frames["iframe_show379"].document.close();
$(window.frames["iframe_show379"]).load(function(){
$("#iframe_show379").height($("#iframe_show379").contents().find("body").height()+showittryitheight);
});
$("#iframe_show379").height($("#iframe_show379").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<form action="/study/login.jsp">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
<form action="/study/login.jsp">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<input type="submit" value="提交">
<input type="reset" value="重置">
</form>
");
window.frames["iframe379"].document.write(decodeHtml(code379));
window.frames["iframe379"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe379"]).load(function(){
$("#iframe379").height($("#iframe379").contents().find("body").height()+showittryitheight);
});
$("#iframe379").height($("#iframe379").contents().find("body").height()+showittryitheight);
alreadyWriteCode379 = code379;
$("#rendering379").hide();
$("#rendered379").show();
}
var tRereshRetry2DemoPanel379 = setInterval(rereshRetry2DemoPanel379,1000);
var binded379 = false;
$("textarea#stepcodeTextarea379").keyup(function(){
if(!binded379){
$(window).bind('beforeunload',function(){
binded379 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code379 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code379!=newCode){
// window.frames["iframe379"].document.write("
");
// window.frames["iframe379"].document.write(decodeHtml($("textarea#stepcodeTextarea379").val()));
// window.frames["iframe379"].document.close();
// $(window.frames["iframe379"]).load(function(){
// $("#iframe379").height($("#iframe379").contents().find("body").height()+showittryitheight);
// });
// code379 = newCode;
// }
});
$(".tryButton379").click(function(){
$("#tryDiv379").show();
$("#stepcodeTextarea379").focus();
$("#stepcodeTextarea379").height(200);
$("#iframe379").height(0);
window.frames["iframe379"].document.write("
");
window.frames["iframe379"].document.write(decodeHtml($("textarea#stepcodeTextarea379").val()));
window.frames["iframe379"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe379"]).load(function(){
$("#iframe379").height($("#iframe379").contents().find("body").height()+showittryitheight);
});
$("#iframe379").height($("#iframe379").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor379.focus();
editor379.setSize(null, "250");
$("#rendering379").hide();
$("#rendered379").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 editor379 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea379"), {
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);
}
}
});
editor379.on("change",function(doc){
if(!binded379){
$(window).bind('beforeunload',function(){
binded379 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code379 = newCode;
$("textarea#stepcodeTextarea379").val(newCode);
if(alreadyWriteCode379!=code379){
lastModifedTime379 = new Date().getTime();
$("#rendering379").show();
$("#rendered379").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor379 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor379.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv379").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|