|
工具版本兼容问题
JSON JavaScript 对象表示法(JavaScript Object Notation) 是一种存储数据的方式。
示例
1
:
创建JSON对象
示例
2
:
访问JSON对象
var gareen = {"name":"盖伦","hp":616};
这样就创建了一个JSON 对象
JSON对象由 名称/值对组成 名称和值之间用冒号:隔开
名称必须用双引号" 包含起来
值可以是任意javascript数据类型,字符串,布尔,数字 ,数组甚至是对象
不同的名称/值对之间用 逗号 , 隔开
");
window.frames["iframe_show1237"].document.write(decodeHtml($("textarea#stepcodeTextarea1237").val()));
window.frames["iframe_show1237"].document.close();
$(window.frames["iframe_show1237"]).load(function(){
$("#iframe_show1237").height($("#iframe_show1237").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1237").height($("#iframe_show1237").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
var gareen = {"name":"盖伦","hp":616};
document.write("这是一个JSON对象: "+gareen);
</script>
<script>
var gareen = {"name":"盖伦","hp":616};
document.write("这是一个JSON对象: "+gareen);
</script>
");
window.frames["iframe1237"].document.write(decodeHtml(code1237));
window.frames["iframe1237"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1237"]).load(function(){
$("#iframe1237").height($("#iframe1237").contents().find("body").height()+showittryitheight);
});
$("#iframe1237").height($("#iframe1237").contents().find("body").height()+showittryitheight);
alreadyWriteCode1237 = code1237;
$("#rendering1237").hide();
$("#rendered1237").show();
}
var tRereshRetry2DemoPanel1237 = setInterval(rereshRetry2DemoPanel1237,1000);
var binded1237 = false;
$("textarea#stepcodeTextarea1237").keyup(function(){
if(!binded1237){
$(window).bind('beforeunload',function(){
binded1237 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1237 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1237!=newCode){
// window.frames["iframe1237"].document.write("
");
// window.frames["iframe1237"].document.write(decodeHtml($("textarea#stepcodeTextarea1237").val()));
// window.frames["iframe1237"].document.close();
// $(window.frames["iframe1237"]).load(function(){
// $("#iframe1237").height($("#iframe1237").contents().find("body").height()+showittryitheight);
// });
// code1237 = newCode;
// }
});
$(".tryButton1237").click(function(){
$("#tryDiv1237").show();
$("#stepcodeTextarea1237").focus();
$("#stepcodeTextarea1237").height(200);
$("#iframe1237").height(0);
window.frames["iframe1237"].document.write("
");
window.frames["iframe1237"].document.write(decodeHtml($("textarea#stepcodeTextarea1237").val()));
window.frames["iframe1237"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1237"]).load(function(){
$("#iframe1237").height($("#iframe1237").contents().find("body").height()+showittryitheight);
});
$("#iframe1237").height($("#iframe1237").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1237.focus();
editor1237.setSize(null, "250");
$("#rendering1237").hide();
$("#rendered1237").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 editor1237 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1237"), {
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);
}
}
});
editor1237.on("change",function(doc){
if(!binded1237){
$(window).bind('beforeunload',function(){
binded1237 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1237 = newCode;
$("textarea#stepcodeTextarea1237").val(newCode);
if(alreadyWriteCode1237!=code1237){
lastModifedTime1237 = new Date().getTime();
$("#rendering1237").show();
$("#rendered1237").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1237 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1237.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1237").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show1238"].document.write(decodeHtml($("textarea#stepcodeTextarea1238").val()));
window.frames["iframe_show1238"].document.close();
$(window.frames["iframe_show1238"]).load(function(){
$("#iframe_show1238").height($("#iframe_show1238").contents().find("body").height()+showittryitheight);
});
$("#iframe_show1238").height($("#iframe_show1238").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<script>
var gareen = {"name":"盖伦","hp":616};
document.write("英雄名称: " + gareen.name + "<br>");
document.write("英雄血量: " + gareen.hp + "<br>");
</script>
<script>
var gareen = {"name":"盖伦","hp":616};
document.write("英雄名称: " + gareen.name + "<br>");
document.write("英雄血量: " + gareen.hp + "<br>");
</script>
");
window.frames["iframe1238"].document.write(decodeHtml(code1238));
window.frames["iframe1238"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1238"]).load(function(){
$("#iframe1238").height($("#iframe1238").contents().find("body").height()+showittryitheight);
});
$("#iframe1238").height($("#iframe1238").contents().find("body").height()+showittryitheight);
alreadyWriteCode1238 = code1238;
$("#rendering1238").hide();
$("#rendered1238").show();
}
var tRereshRetry2DemoPanel1238 = setInterval(rereshRetry2DemoPanel1238,1000);
var binded1238 = false;
$("textarea#stepcodeTextarea1238").keyup(function(){
if(!binded1238){
$(window).bind('beforeunload',function(){
binded1238 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code1238 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code1238!=newCode){
// window.frames["iframe1238"].document.write("
");
// window.frames["iframe1238"].document.write(decodeHtml($("textarea#stepcodeTextarea1238").val()));
// window.frames["iframe1238"].document.close();
// $(window.frames["iframe1238"]).load(function(){
// $("#iframe1238").height($("#iframe1238").contents().find("body").height()+showittryitheight);
// });
// code1238 = newCode;
// }
});
$(".tryButton1238").click(function(){
$("#tryDiv1238").show();
$("#stepcodeTextarea1238").focus();
$("#stepcodeTextarea1238").height(200);
$("#iframe1238").height(0);
window.frames["iframe1238"].document.write("
");
window.frames["iframe1238"].document.write(decodeHtml($("textarea#stepcodeTextarea1238").val()));
window.frames["iframe1238"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe1238"]).load(function(){
$("#iframe1238").height($("#iframe1238").contents().find("body").height()+showittryitheight);
});
$("#iframe1238").height($("#iframe1238").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor1238.focus();
editor1238.setSize(null, "250");
$("#rendering1238").hide();
$("#rendered1238").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 editor1238 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea1238"), {
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);
}
}
});
editor1238.on("change",function(doc){
if(!binded1238){
$(window).bind('beforeunload',function(){
binded1238 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code1238 = newCode;
$("textarea#stepcodeTextarea1238").val(newCode);
if(alreadyWriteCode1238!=code1238){
lastModifedTime1238 = new Date().getTime();
$("#rendering1238").show();
$("#rendered1238").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor1238 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor1238.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv1238").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|