|
示例
1
:
普通按钮
示例
2
:
普通按钮不具备提交form的效果
");
window.frames["iframe_show372"].document.write(decodeHtml($("textarea#stepcodeTextarea372").val()));
window.frames["iframe_show372"].document.close();
$(window.frames["iframe_show372"]).load(function(){
$("#iframe_show372").height($("#iframe_show372").contents().find("body").height()+showittryitheight);
});
$("#iframe_show372").height($("#iframe_show372").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<input type="button" value="一个按钮">
<input type="button" value="一个按钮">
");
window.frames["iframe372"].document.write(decodeHtml(code372));
window.frames["iframe372"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe372"]).load(function(){
$("#iframe372").height($("#iframe372").contents().find("body").height()+showittryitheight);
});
$("#iframe372").height($("#iframe372").contents().find("body").height()+showittryitheight);
alreadyWriteCode372 = code372;
$("#rendering372").hide();
$("#rendered372").show();
}
var tRereshRetry2DemoPanel372 = setInterval(rereshRetry2DemoPanel372,1000);
var binded372 = false;
$("textarea#stepcodeTextarea372").keyup(function(){
if(!binded372){
$(window).bind('beforeunload',function(){
binded372 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code372 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code372!=newCode){
// window.frames["iframe372"].document.write("
");
// window.frames["iframe372"].document.write(decodeHtml($("textarea#stepcodeTextarea372").val()));
// window.frames["iframe372"].document.close();
// $(window.frames["iframe372"]).load(function(){
// $("#iframe372").height($("#iframe372").contents().find("body").height()+showittryitheight);
// });
// code372 = newCode;
// }
});
$(".tryButton372").click(function(){
$("#tryDiv372").show();
$("#stepcodeTextarea372").focus();
$("#stepcodeTextarea372").height(200);
$("#iframe372").height(0);
window.frames["iframe372"].document.write("
");
window.frames["iframe372"].document.write(decodeHtml($("textarea#stepcodeTextarea372").val()));
window.frames["iframe372"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe372"]).load(function(){
$("#iframe372").height($("#iframe372").contents().find("body").height()+showittryitheight);
});
$("#iframe372").height($("#iframe372").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor372.focus();
editor372.setSize(null, "250");
$("#rendering372").hide();
$("#rendered372").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 editor372 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea372"), {
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);
}
}
});
editor372.on("change",function(doc){
if(!binded372){
$(window).bind('beforeunload',function(){
binded372 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code372 = newCode;
$("textarea#stepcodeTextarea372").val(newCode);
if(alreadyWriteCode372!=code372){
lastModifedTime372 = new Date().getTime();
$("#rendering372").show();
$("#rendered372").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor372 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor372.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv372").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
示例
2
:
普通按钮不具备提交form的效果
顶
折
");
window.frames["iframe_show373"].document.write(decodeHtml($("textarea#stepcodeTextarea373").val()));
window.frames["iframe_show373"].document.close();
$(window.frames["iframe_show373"]).load(function(){
$("#iframe_show373").height($("#iframe_show373").contents().find("body").height()+showittryitheight);
});
$("#iframe_show373").height($("#iframe_show373").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
普通按钮不能提交
<form action="/study/login.jsp" method="get">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<input type="button" value="登陆">
</form>
普通按钮不能提交
<form action="/study/login.jsp" method="get">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<input type="button" value="登陆">
</form>
");
window.frames["iframe373"].document.write(decodeHtml(code373));
window.frames["iframe373"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe373"]).load(function(){
$("#iframe373").height($("#iframe373").contents().find("body").height()+showittryitheight);
});
$("#iframe373").height($("#iframe373").contents().find("body").height()+showittryitheight);
alreadyWriteCode373 = code373;
$("#rendering373").hide();
$("#rendered373").show();
}
var tRereshRetry2DemoPanel373 = setInterval(rereshRetry2DemoPanel373,1000);
var binded373 = false;
$("textarea#stepcodeTextarea373").keyup(function(){
if(!binded373){
$(window).bind('beforeunload',function(){
binded373 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code373 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code373!=newCode){
// window.frames["iframe373"].document.write("
");
// window.frames["iframe373"].document.write(decodeHtml($("textarea#stepcodeTextarea373").val()));
// window.frames["iframe373"].document.close();
// $(window.frames["iframe373"]).load(function(){
// $("#iframe373").height($("#iframe373").contents().find("body").height()+showittryitheight);
// });
// code373 = newCode;
// }
});
$(".tryButton373").click(function(){
$("#tryDiv373").show();
$("#stepcodeTextarea373").focus();
$("#stepcodeTextarea373").height(200);
$("#iframe373").height(0);
window.frames["iframe373"].document.write("
");
window.frames["iframe373"].document.write(decodeHtml($("textarea#stepcodeTextarea373").val()));
window.frames["iframe373"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe373"]).load(function(){
$("#iframe373").height($("#iframe373").contents().find("body").height()+showittryitheight);
});
$("#iframe373").height($("#iframe373").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor373.focus();
editor373.setSize(null, "250");
$("#rendering373").hide();
$("#rendered373").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 editor373 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea373"), {
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);
}
}
});
editor373.on("change",function(doc){
if(!binded373){
$(window).bind('beforeunload',function(){
binded373 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code373 = newCode;
$("textarea#stepcodeTextarea373").val(newCode);
if(alreadyWriteCode373!=code373){
lastModifedTime373 = new Date().getTime();
$("#rendering373").show();
$("#rendered373").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor373 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor373.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv373").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|