示例
1
:
返回用户的屏幕大小,以及可用屏幕大小
顶
折
如果是在台式电脑上,通常看到的可用区域的高度会比屏幕高度小一点,因为有任务栏的存在。
");
window.frames["iframe_show1159"].document.write(decodeHtml($("textarea#stepcodeTextarea1159").val()));
window.frames["iframe_show1159"].document.close();
$(window.frames["iframe_show1159"]).load(function(){
$("#iframe_show1159").height($("#iframe_show1159").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1159").height($("#iframe_show1159").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<html>
<body>
<script type="text/javascript">
document.write("用户的屏幕分辨率: ")
document.write(screen.width + "*" + screen.height)
document.write("<br />")
document.write("可用区域大小: ")
document.write(screen.availWidth + "*" + screen.availHeight)
document.write("<br />")
</script>
</body>
</html>
<html>
<body>
<script type="text/javascript">
document.write("用户的屏幕分辨率: ")
document.write(screen.width + "*" + screen.height)
document.write("<br />")
document.write("可用区域大小: ")
document.write(screen.availWidth + "*" + screen.availHeight)
document.write("<br />")
</script>
</body>
</html>
");
window.frames["iframe1159"].document.write(decodeHtml(code1159));
window.frames["iframe1159"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1159"]).load(function(){
$("#iframe1159").height($("#iframe1159").contents().find("body").height()+showittryitheight);
});
$("#iframe1159").height($("#iframe1159").contents().find("body").height()+showittryitheight);
alreadyWriteCode1159 = code1159;
$("#rendering1159").hide();
$("#rendered1159").show();
}
var tRereshRetry2DemoPanel1159 = setInterval(rereshRetry2DemoPanel1159,1000);
var binded1159 = false;
$("textarea#stepcodeTextarea1159").keyup(function(){
if(!binded1159){
$(window).bind('beforeunload',function(){
binded1159 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1159 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1159!=newCode){
// window.frames["iframe1159"].document.write("
");
// window.frames["iframe1159"].document.write(decodeHtml($("textarea#stepcodeTextarea1159").val()));
// window.frames["iframe1159"].document.close();
// $(window.frames["iframe1159"]).load(function(){
// $("#iframe1159").height($("#iframe1159").contents().find("body").height()+showittryitheight);
// });
// code1159 = newCode;
// }
});
$(".tryButton1159").click(function(){
$("#tryDiv1159").show();
$("#stepcodeTextarea1159").focus();
$("#stepcodeTextarea1159").height(200);
$("#iframe1159").height(0);
window.frames["iframe1159"].document.write("
");
window.frames["iframe1159"].document.write(decodeHtml($("textarea#stepcodeTextarea1159").val()));
window.frames["iframe1159"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1159"]).load(function(){
$("#iframe1159").height($("#iframe1159").contents().find("body").height()+showittryitheight);
});
$("#iframe1159").height($("#iframe1159").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1159.focus();
editor1159.setSize(null, "250");
$("#rendering1159").hide();
$("#rendered1159").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 editor1159 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1159"), {
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);
}
}
});
editor1159.on("change",function(doc){
if(!binded1159){
$(window).bind('beforeunload',function(){
binded1159 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1159 = newCode;
$("textarea#stepcodeTextarea1159").val(newCode);
if(alreadyWriteCode1159!=code1159){
lastModifedTime1159 = new Date().getTime();
$("#rendering1159").show();
$("#rendered1159").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1159 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1159.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1159").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|