|
关键字 |
简介 |
示例代码 |
属性E PI
|
自然对数和圆周率
|
示例代码
|
方法 abs
|
绝对值
|
示例代码
|
方法 min max
|
最小最大
|
示例代码
|
方法 pow
|
求幂
|
示例代码
|
方法 round
|
四舍五入
|
示例代码
|
方法 random
|
随机数
|
示例代码
|
步骤
1
:
自然对数和圆周率
步骤
2
:
绝对值
步骤
3
:
最小最大
步骤
4
:
求幂
步骤
5
:
四舍五入
步骤
6
:
随机数
");
window.frames["iframe_show1142"].document.write(decodeHtml($("textarea#stepcodeTextarea1142").val()));
window.frames["iframe_show1142"].document.close();
$(window.frames["iframe_show1142"]).load(function(){
$("#iframe_show1142").height($("#iframe_show1142").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1142").height($("#iframe_show1142").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write(Math.E);
document.write("<br>");
document.write(Math.PI);
</script>
<script>
document.write(Math.E);
document.write("<br>");
document.write(Math.PI);
</script>
");
window.frames["iframe1142"].document.write(decodeHtml(code1142));
window.frames["iframe1142"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1142"]).load(function(){
$("#iframe1142").height($("#iframe1142").contents().find("body").height()+showittryitheight);
});
$("#iframe1142").height($("#iframe1142").contents().find("body").height()+showittryitheight);
alreadyWriteCode1142 = code1142;
$("#rendering1142").hide();
$("#rendered1142").show();
}
var tRereshRetry2DemoPanel1142 = setInterval(rereshRetry2DemoPanel1142,1000);
var binded1142 = false;
$("textarea#stepcodeTextarea1142").keyup(function(){
if(!binded1142){
$(window).bind('beforeunload',function(){
binded1142 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1142 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1142!=newCode){
// window.frames["iframe1142"].document.write("
");
// window.frames["iframe1142"].document.write(decodeHtml($("textarea#stepcodeTextarea1142").val()));
// window.frames["iframe1142"].document.close();
// $(window.frames["iframe1142"]).load(function(){
// $("#iframe1142").height($("#iframe1142").contents().find("body").height()+showittryitheight);
// });
// code1142 = newCode;
// }
});
$(".tryButton1142").click(function(){
$("#tryDiv1142").show();
$("#stepcodeTextarea1142").focus();
$("#stepcodeTextarea1142").height(200);
$("#iframe1142").height(0);
window.frames["iframe1142"].document.write("
");
window.frames["iframe1142"].document.write(decodeHtml($("textarea#stepcodeTextarea1142").val()));
window.frames["iframe1142"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1142"]).load(function(){
$("#iframe1142").height($("#iframe1142").contents().find("body").height()+showittryitheight);
});
$("#iframe1142").height($("#iframe1142").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1142.focus();
editor1142.setSize(null, "250");
$("#rendering1142").hide();
$("#rendered1142").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 editor1142 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1142"), {
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);
}
}
});
editor1142.on("change",function(doc){
if(!binded1142){
$(window).bind('beforeunload',function(){
binded1142 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1142 = newCode;
$("textarea#stepcodeTextarea1142").val(newCode);
if(alreadyWriteCode1142!=code1142){
lastModifedTime1142 = new Date().getTime();
$("#rendering1142").show();
$("#rendered1142").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1142 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1142.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1142").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1143"].document.write(decodeHtml($("textarea#stepcodeTextarea1143").val()));
window.frames["iframe_show1143"].document.close();
$(window.frames["iframe_show1143"]).load(function(){
$("#iframe_show1143").height($("#iframe_show1143").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1143").height($("#iframe_show1143").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write(Math.abs(-1));
</script>
<script>
document.write(Math.abs(-1));
</script>
");
window.frames["iframe1143"].document.write(decodeHtml(code1143));
window.frames["iframe1143"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1143"]).load(function(){
$("#iframe1143").height($("#iframe1143").contents().find("body").height()+showittryitheight);
});
$("#iframe1143").height($("#iframe1143").contents().find("body").height()+showittryitheight);
alreadyWriteCode1143 = code1143;
$("#rendering1143").hide();
$("#rendered1143").show();
}
var tRereshRetry2DemoPanel1143 = setInterval(rereshRetry2DemoPanel1143,1000);
var binded1143 = false;
$("textarea#stepcodeTextarea1143").keyup(function(){
if(!binded1143){
$(window).bind('beforeunload',function(){
binded1143 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1143 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1143!=newCode){
// window.frames["iframe1143"].document.write("
");
// window.frames["iframe1143"].document.write(decodeHtml($("textarea#stepcodeTextarea1143").val()));
// window.frames["iframe1143"].document.close();
// $(window.frames["iframe1143"]).load(function(){
// $("#iframe1143").height($("#iframe1143").contents().find("body").height()+showittryitheight);
// });
// code1143 = newCode;
// }
});
$(".tryButton1143").click(function(){
$("#tryDiv1143").show();
$("#stepcodeTextarea1143").focus();
$("#stepcodeTextarea1143").height(200);
$("#iframe1143").height(0);
window.frames["iframe1143"].document.write("
");
window.frames["iframe1143"].document.write(decodeHtml($("textarea#stepcodeTextarea1143").val()));
window.frames["iframe1143"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1143"]).load(function(){
$("#iframe1143").height($("#iframe1143").contents().find("body").height()+showittryitheight);
});
$("#iframe1143").height($("#iframe1143").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1143.focus();
editor1143.setSize(null, "250");
$("#rendering1143").hide();
$("#rendered1143").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 editor1143 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1143"), {
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);
}
}
});
editor1143.on("change",function(doc){
if(!binded1143){
$(window).bind('beforeunload',function(){
binded1143 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1143 = newCode;
$("textarea#stepcodeTextarea1143").val(newCode);
if(alreadyWriteCode1143!=code1143){
lastModifedTime1143 = new Date().getTime();
$("#rendering1143").show();
$("#rendered1143").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1143 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1143.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1143").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1144"].document.write(decodeHtml($("textarea#stepcodeTextarea1144").val()));
window.frames["iframe_show1144"].document.close();
$(window.frames["iframe_show1144"]).load(function(){
$("#iframe_show1144").height($("#iframe_show1144").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1144").height($("#iframe_show1144").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write(Math.min(1,100));
document.write("<br>");
document.write(Math.max(1,100));
</script>
<script>
document.write(Math.min(1,100));
document.write("<br>");
document.write(Math.max(1,100));
</script>
");
window.frames["iframe1144"].document.write(decodeHtml(code1144));
window.frames["iframe1144"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1144"]).load(function(){
$("#iframe1144").height($("#iframe1144").contents().find("body").height()+showittryitheight);
});
$("#iframe1144").height($("#iframe1144").contents().find("body").height()+showittryitheight);
alreadyWriteCode1144 = code1144;
$("#rendering1144").hide();
$("#rendered1144").show();
}
var tRereshRetry2DemoPanel1144 = setInterval(rereshRetry2DemoPanel1144,1000);
var binded1144 = false;
$("textarea#stepcodeTextarea1144").keyup(function(){
if(!binded1144){
$(window).bind('beforeunload',function(){
binded1144 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1144 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1144!=newCode){
// window.frames["iframe1144"].document.write("
");
// window.frames["iframe1144"].document.write(decodeHtml($("textarea#stepcodeTextarea1144").val()));
// window.frames["iframe1144"].document.close();
// $(window.frames["iframe1144"]).load(function(){
// $("#iframe1144").height($("#iframe1144").contents().find("body").height()+showittryitheight);
// });
// code1144 = newCode;
// }
});
$(".tryButton1144").click(function(){
$("#tryDiv1144").show();
$("#stepcodeTextarea1144").focus();
$("#stepcodeTextarea1144").height(200);
$("#iframe1144").height(0);
window.frames["iframe1144"].document.write("
");
window.frames["iframe1144"].document.write(decodeHtml($("textarea#stepcodeTextarea1144").val()));
window.frames["iframe1144"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1144"]).load(function(){
$("#iframe1144").height($("#iframe1144").contents().find("body").height()+showittryitheight);
});
$("#iframe1144").height($("#iframe1144").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1144.focus();
editor1144.setSize(null, "250");
$("#rendering1144").hide();
$("#rendered1144").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 editor1144 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1144"), {
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);
}
}
});
editor1144.on("change",function(doc){
if(!binded1144){
$(window).bind('beforeunload',function(){
binded1144 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1144 = newCode;
$("textarea#stepcodeTextarea1144").val(newCode);
if(alreadyWriteCode1144!=code1144){
lastModifedTime1144 = new Date().getTime();
$("#rendering1144").show();
$("#rendered1144").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1144 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1144.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1144").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1145"].document.write(decodeHtml($("textarea#stepcodeTextarea1145").val()));
window.frames["iframe_show1145"].document.close();
$(window.frames["iframe_show1145"]).load(function(){
$("#iframe_show1145").height($("#iframe_show1145").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1145").height($("#iframe_show1145").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write(Math.pow(3,3)); //3的立方,即27
</script>
<script>
document.write(Math.pow(3,3)); //3的立方,即27
</script>
");
window.frames["iframe1145"].document.write(decodeHtml(code1145));
window.frames["iframe1145"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1145"]).load(function(){
$("#iframe1145").height($("#iframe1145").contents().find("body").height()+showittryitheight);
});
$("#iframe1145").height($("#iframe1145").contents().find("body").height()+showittryitheight);
alreadyWriteCode1145 = code1145;
$("#rendering1145").hide();
$("#rendered1145").show();
}
var tRereshRetry2DemoPanel1145 = setInterval(rereshRetry2DemoPanel1145,1000);
var binded1145 = false;
$("textarea#stepcodeTextarea1145").keyup(function(){
if(!binded1145){
$(window).bind('beforeunload',function(){
binded1145 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1145 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1145!=newCode){
// window.frames["iframe1145"].document.write("
");
// window.frames["iframe1145"].document.write(decodeHtml($("textarea#stepcodeTextarea1145").val()));
// window.frames["iframe1145"].document.close();
// $(window.frames["iframe1145"]).load(function(){
// $("#iframe1145").height($("#iframe1145").contents().find("body").height()+showittryitheight);
// });
// code1145 = newCode;
// }
});
$(".tryButton1145").click(function(){
$("#tryDiv1145").show();
$("#stepcodeTextarea1145").focus();
$("#stepcodeTextarea1145").height(200);
$("#iframe1145").height(0);
window.frames["iframe1145"].document.write("
");
window.frames["iframe1145"].document.write(decodeHtml($("textarea#stepcodeTextarea1145").val()));
window.frames["iframe1145"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1145"]).load(function(){
$("#iframe1145").height($("#iframe1145").contents().find("body").height()+showittryitheight);
});
$("#iframe1145").height($("#iframe1145").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1145.focus();
editor1145.setSize(null, "250");
$("#rendering1145").hide();
$("#rendered1145").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 editor1145 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1145"), {
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);
}
}
});
editor1145.on("change",function(doc){
if(!binded1145){
$(window).bind('beforeunload',function(){
binded1145 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1145 = newCode;
$("textarea#stepcodeTextarea1145").val(newCode);
if(alreadyWriteCode1145!=code1145){
lastModifedTime1145 = new Date().getTime();
$("#rendering1145").show();
$("#rendered1145").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1145 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1145.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1145").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1147"].document.write(decodeHtml($("textarea#stepcodeTextarea1147").val()));
window.frames["iframe_show1147"].document.close();
$(window.frames["iframe_show1147"]).load(function(){
$("#iframe_show1147").height($("#iframe_show1147").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1147").height($("#iframe_show1147").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write(Math.round(3.4));
document.write("<br>");
document.write(Math.round(3.5));
</script>
<script>
document.write(Math.round(3.4));
document.write("<br>");
document.write(Math.round(3.5));
</script>
");
window.frames["iframe1147"].document.write(decodeHtml(code1147));
window.frames["iframe1147"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1147"]).load(function(){
$("#iframe1147").height($("#iframe1147").contents().find("body").height()+showittryitheight);
});
$("#iframe1147").height($("#iframe1147").contents().find("body").height()+showittryitheight);
alreadyWriteCode1147 = code1147;
$("#rendering1147").hide();
$("#rendered1147").show();
}
var tRereshRetry2DemoPanel1147 = setInterval(rereshRetry2DemoPanel1147,1000);
var binded1147 = false;
$("textarea#stepcodeTextarea1147").keyup(function(){
if(!binded1147){
$(window).bind('beforeunload',function(){
binded1147 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1147 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1147!=newCode){
// window.frames["iframe1147"].document.write("
");
// window.frames["iframe1147"].document.write(decodeHtml($("textarea#stepcodeTextarea1147").val()));
// window.frames["iframe1147"].document.close();
// $(window.frames["iframe1147"]).load(function(){
// $("#iframe1147").height($("#iframe1147").contents().find("body").height()+showittryitheight);
// });
// code1147 = newCode;
// }
});
$(".tryButton1147").click(function(){
$("#tryDiv1147").show();
$("#stepcodeTextarea1147").focus();
$("#stepcodeTextarea1147").height(200);
$("#iframe1147").height(0);
window.frames["iframe1147"].document.write("
");
window.frames["iframe1147"].document.write(decodeHtml($("textarea#stepcodeTextarea1147").val()));
window.frames["iframe1147"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1147"]).load(function(){
$("#iframe1147").height($("#iframe1147").contents().find("body").height()+showittryitheight);
});
$("#iframe1147").height($("#iframe1147").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1147.focus();
editor1147.setSize(null, "250");
$("#rendering1147").hide();
$("#rendered1147").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 editor1147 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1147"), {
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);
}
}
});
editor1147.on("change",function(doc){
if(!binded1147){
$(window).bind('beforeunload',function(){
binded1147 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1147 = newCode;
$("textarea#stepcodeTextarea1147").val(newCode);
if(alreadyWriteCode1147!=code1147){
lastModifedTime1147 = new Date().getTime();
$("#rendering1147").show();
$("#rendered1147").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1147 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1147.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1147").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1146"].document.write(decodeHtml($("textarea#stepcodeTextarea1146").val()));
window.frames["iframe_show1146"].document.close();
$(window.frames["iframe_show1146"]).load(function(){
$("#iframe_show1146").height($("#iframe_show1146").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1146").height($("#iframe_show1146").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
document.write("一个 0-1 之间的随机数 : Math.random():");
document.write("<br>");
document.write(Math.random());
document.write("<br>");
document.write("十个 5-10 之间的随机数 : Math.round(Math.random() *5)+5 ");
document.write("<br>");
for(i=0;i<10;i++){
document.write(Math.round(Math.random() *5)+5 ); //5-10之间的随机整数
document.write("<br>");
}
</script>
<script>
document.write("一个 0-1 之间的随机数 : Math.random():");
document.write("<br>");
document.write(Math.random());
document.write("<br>");
document.write("十个 5-10 之间的随机数 : Math.round(Math.random() *5)+5 ");
document.write("<br>");
for(i=0;i<10;i++){
document.write(Math.round(Math.random() *5)+5 ); //5-10之间的随机整数
document.write("<br>");
}
</script>
");
window.frames["iframe1146"].document.write(decodeHtml(code1146));
window.frames["iframe1146"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1146"]).load(function(){
$("#iframe1146").height($("#iframe1146").contents().find("body").height()+showittryitheight);
});
$("#iframe1146").height($("#iframe1146").contents().find("body").height()+showittryitheight);
alreadyWriteCode1146 = code1146;
$("#rendering1146").hide();
$("#rendered1146").show();
}
var tRereshRetry2DemoPanel1146 = setInterval(rereshRetry2DemoPanel1146,1000);
var binded1146 = false;
$("textarea#stepcodeTextarea1146").keyup(function(){
if(!binded1146){
$(window).bind('beforeunload',function(){
binded1146 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1146 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1146!=newCode){
// window.frames["iframe1146"].document.write("
");
// window.frames["iframe1146"].document.write(decodeHtml($("textarea#stepcodeTextarea1146").val()));
// window.frames["iframe1146"].document.close();
// $(window.frames["iframe1146"]).load(function(){
// $("#iframe1146").height($("#iframe1146").contents().find("body").height()+showittryitheight);
// });
// code1146 = newCode;
// }
});
$(".tryButton1146").click(function(){
$("#tryDiv1146").show();
$("#stepcodeTextarea1146").focus();
$("#stepcodeTextarea1146").height(200);
$("#iframe1146").height(0);
window.frames["iframe1146"].document.write("
");
window.frames["iframe1146"].document.write(decodeHtml($("textarea#stepcodeTextarea1146").val()));
window.frames["iframe1146"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1146"]).load(function(){
$("#iframe1146").height($("#iframe1146").contents().find("body").height()+showittryitheight);
});
$("#iframe1146").height($("#iframe1146").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1146.focus();
editor1146.setSize(null, "250");
$("#rendering1146").hide();
$("#rendered1146").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 editor1146 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1146"), {
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);
}
}
});
editor1146.on("change",function(doc){
if(!binded1146){
$(window).bind('beforeunload',function(){
binded1146 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1146 = newCode;
$("textarea#stepcodeTextarea1146").val(newCode);
if(alreadyWriteCode1146!=code1146){
lastModifedTime1146 = new Date().getTime();
$("#rendering1146").show();
$("#rendered1146").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1146 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1146.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1146").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|