");
window.frames["iframe_show328"].document.write(decodeHtml($("textarea#stepcodeTextarea328").val()));
window.frames["iframe_show328"].document.close();
$(window.frames["iframe_show328"]).load(function(){
$("#iframe_show328").height($("#iframe_show328").contents().find("body").height()+showittryitheight);
});
$("#iframe_show328").height($("#iframe_show328").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<p>无删除效果</p>
<del>使用del标签实现的删除效果</del>
<br/>
<s>使用s标签实现的删除效果,但是不建议使用,因为很多浏览器不支持s标签</s>
<p>无删除效果</p>
<del>使用del标签实现的删除效果</del>
<br/>
<s>使用s标签实现的删除效果,但是不建议使用,因为很多浏览器不支持s标签</s>
");
window.frames["iframe328"].document.write(decodeHtml(code328));
window.frames["iframe328"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe328"]).load(function(){
$("#iframe328").height($("#iframe328").contents().find("body").height()+showittryitheight);
});
$("#iframe328").height($("#iframe328").contents().find("body").height()+showittryitheight);
alreadyWriteCode328 = code328;
$("#rendering328").hide();
$("#rendered328").show();
}
var tRereshRetry2DemoPanel328 = setInterval(rereshRetry2DemoPanel328,1000);
var binded328 = false;
$("textarea#stepcodeTextarea328").keyup(function(){
if(!binded328){
$(window).bind('beforeunload',function(){
binded328 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code328 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code328!=newCode){
// window.frames["iframe328"].document.write("
");
// window.frames["iframe328"].document.write(decodeHtml($("textarea#stepcodeTextarea328").val()));
// window.frames["iframe328"].document.close();
// $(window.frames["iframe328"]).load(function(){
// $("#iframe328").height($("#iframe328").contents().find("body").height()+showittryitheight);
// });
// code328 = newCode;
// }
});
$(".tryButton328").click(function(){
$("#tryDiv328").show();
$("#stepcodeTextarea328").focus();
$("#stepcodeTextarea328").height(200);
$("#iframe328").height(0);
window.frames["iframe328"].document.write("
");
window.frames["iframe328"].document.write(decodeHtml($("textarea#stepcodeTextarea328").val()));
window.frames["iframe328"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe328"]).load(function(){
$("#iframe328").height($("#iframe328").contents().find("body").height()+showittryitheight);
});
$("#iframe328").height($("#iframe328").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor328.focus();
editor328.setSize(null, "250");
$("#rendering328").hide();
$("#rendered328").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 editor328 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea328"), {
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);
}
}
});
editor328.on("change",function(doc){
if(!binded328){
$(window).bind('beforeunload',function(){
binded328 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code328 = newCode;
$("textarea#stepcodeTextarea328").val(newCode);
if(alreadyWriteCode328!=code328){
lastModifedTime328 = new Date().getTime();
$("#rendering328").show();
$("#rendered328").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor328 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor328.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv328").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|