|
工具版本兼容问题
<button></button>即按钮标签
与<input type="button">不同的是,<button>标签功能更为丰富
按钮标签里的内容可以是文字也可以是图像
如果button的type=“submit” ,那么它就具备提交form的功能
示例
1
:
button里是文字
示例
2
:
button里是图片
示例
3
:
提交数据
");
window.frames["iframe_show375"].document.write(decodeHtml($("textarea#stepcodeTextarea375").val()));
window.frames["iframe_show375"].document.close();
$(window.frames["iframe_show375"]).load(function(){
$("#iframe_show375").height($("#iframe_show375").contents().find("body").height()+showittryitheight);
});
$("#iframe_show375").height($("#iframe_show375").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<button>按钮</button>
");
window.frames["iframe375"].document.write(decodeHtml(code375));
window.frames["iframe375"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe375"]).load(function(){
$("#iframe375").height($("#iframe375").contents().find("body").height()+showittryitheight);
});
$("#iframe375").height($("#iframe375").contents().find("body").height()+showittryitheight);
alreadyWriteCode375 = code375;
$("#rendering375").hide();
$("#rendered375").show();
}
var tRereshRetry2DemoPanel375 = setInterval(rereshRetry2DemoPanel375,1000);
var binded375 = false;
$("textarea#stepcodeTextarea375").keyup(function(){
if(!binded375){
$(window).bind('beforeunload',function(){
binded375 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code375 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code375!=newCode){
// window.frames["iframe375"].document.write("
");
// window.frames["iframe375"].document.write(decodeHtml($("textarea#stepcodeTextarea375").val()));
// window.frames["iframe375"].document.close();
// $(window.frames["iframe375"]).load(function(){
// $("#iframe375").height($("#iframe375").contents().find("body").height()+showittryitheight);
// });
// code375 = newCode;
// }
});
$(".tryButton375").click(function(){
$("#tryDiv375").show();
$("#stepcodeTextarea375").focus();
$("#stepcodeTextarea375").height(200);
$("#iframe375").height(0);
window.frames["iframe375"].document.write("
");
window.frames["iframe375"].document.write(decodeHtml($("textarea#stepcodeTextarea375").val()));
window.frames["iframe375"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe375"]).load(function(){
$("#iframe375").height($("#iframe375").contents().find("body").height()+showittryitheight);
});
$("#iframe375").height($("#iframe375").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor375.focus();
editor375.setSize(null, "250");
$("#rendering375").hide();
$("#rendered375").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 editor375 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea375"), {
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);
}
}
});
editor375.on("change",function(doc){
if(!binded375){
$(window).bind('beforeunload',function(){
binded375 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code375 = newCode;
$("textarea#stepcodeTextarea375").val(newCode);
if(alreadyWriteCode375!=code375){
lastModifedTime375 = new Date().getTime();
$("#rendering375").show();
$("#rendered375").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor375 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor375.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv375").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
");
window.frames["iframe_show376"].document.write(decodeHtml($("textarea#stepcodeTextarea376").val()));
window.frames["iframe_show376"].document.close();
$(window.frames["iframe_show376"]).load(function(){
$("#iframe_show376").height($("#iframe_show376").contents().find("body").height()+showittryitheight);
});
$("#iframe_show376").height($("#iframe_show376").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<button><img src="http://127.0.0.1/example.gif"/></button>
<button><img src="http://127.0.0.1/example.gif"/></button>
");
window.frames["iframe376"].document.write(decodeHtml(code376));
window.frames["iframe376"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe376"]).load(function(){
$("#iframe376").height($("#iframe376").contents().find("body").height()+showittryitheight);
});
$("#iframe376").height($("#iframe376").contents().find("body").height()+showittryitheight);
alreadyWriteCode376 = code376;
$("#rendering376").hide();
$("#rendered376").show();
}
var tRereshRetry2DemoPanel376 = setInterval(rereshRetry2DemoPanel376,1000);
var binded376 = false;
$("textarea#stepcodeTextarea376").keyup(function(){
if(!binded376){
$(window).bind('beforeunload',function(){
binded376 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code376 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code376!=newCode){
// window.frames["iframe376"].document.write("
");
// window.frames["iframe376"].document.write(decodeHtml($("textarea#stepcodeTextarea376").val()));
// window.frames["iframe376"].document.close();
// $(window.frames["iframe376"]).load(function(){
// $("#iframe376").height($("#iframe376").contents().find("body").height()+showittryitheight);
// });
// code376 = newCode;
// }
});
$(".tryButton376").click(function(){
$("#tryDiv376").show();
$("#stepcodeTextarea376").focus();
$("#stepcodeTextarea376").height(200);
$("#iframe376").height(0);
window.frames["iframe376"].document.write("
");
window.frames["iframe376"].document.write(decodeHtml($("textarea#stepcodeTextarea376").val()));
window.frames["iframe376"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe376"]).load(function(){
$("#iframe376").height($("#iframe376").contents().find("body").height()+showittryitheight);
});
$("#iframe376").height($("#iframe376").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor376.focus();
editor376.setSize(null, "250");
$("#rendering376").hide();
$("#rendered376").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 editor376 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea376"), {
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);
}
}
});
editor376.on("change",function(doc){
if(!binded376){
$(window).bind('beforeunload',function(){
binded376 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code376 = newCode;
$("textarea#stepcodeTextarea376").val(newCode);
if(alreadyWriteCode376!=code376){
lastModifedTime376 = new Date().getTime();
$("#rendering376").show();
$("#rendered376").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor376 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor376.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv376").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
设置type="submit"
IE下button的type的默认值为button不具备提交功能
其他浏览器type的默认值是submit
");
window.frames["iframe_show377"].document.write(decodeHtml($("textarea#stepcodeTextarea377").val()));
window.frames["iframe_show377"].document.close();
$(window.frames["iframe_show377"]).load(function(){
$("#iframe_show377").height($("#iframe_show377").contents().find("body").height()+showittryitheight);
});
$("#iframe_show377").height($("#iframe_show377").contents().find("body").height()+showittryitheight);
setTimeout(function(){
},500);
});
<form action="/study/login.jsp">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<button type="submit">登陆</button>
</form>
<form action="/study/login.jsp">
账号:<input type="text" name="name"> <br/>
密码:<input type="password" name="password" > <br/>
<button type="submit">登陆</button>
</form>
");
window.frames["iframe377"].document.write(decodeHtml(code377));
window.frames["iframe377"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe377"]).load(function(){
$("#iframe377").height($("#iframe377").contents().find("body").height()+showittryitheight);
});
$("#iframe377").height($("#iframe377").contents().find("body").height()+showittryitheight);
alreadyWriteCode377 = code377;
$("#rendering377").hide();
$("#rendered377").show();
}
var tRereshRetry2DemoPanel377 = setInterval(rereshRetry2DemoPanel377,1000);
var binded377 = false;
$("textarea#stepcodeTextarea377").keyup(function(){
if(!binded377){
$(window).bind('beforeunload',function(){
binded377 = true;
return "xxxx";
});
}
var newCode = $(this).val()
code377 = newCode;
/*below code is replaced by function rereshRetry2DemoPanel()*/
// if(code377!=newCode){
// window.frames["iframe377"].document.write("
");
// window.frames["iframe377"].document.write(decodeHtml($("textarea#stepcodeTextarea377").val()));
// window.frames["iframe377"].document.close();
// $(window.frames["iframe377"]).load(function(){
// $("#iframe377").height($("#iframe377").contents().find("body").height()+showittryitheight);
// });
// code377 = newCode;
// }
});
$(".tryButton377").click(function(){
$("#tryDiv377").show();
$("#stepcodeTextarea377").focus();
$("#stepcodeTextarea377").height(200);
$("#iframe377").height(0);
window.frames["iframe377"].document.write("
");
window.frames["iframe377"].document.write(decodeHtml($("textarea#stepcodeTextarea377").val()));
window.frames["iframe377"].document.close();
//load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式
$(window.frames["iframe377"]).load(function(){
$("#iframe377").height($("#iframe377").contents().find("body").height()+showittryitheight);
});
$("#iframe377").height($("#iframe377").contents().find("body").height()+showittryitheight);
this.scrollIntoView(true);
editor377.focus();
editor377.setSize(null, "250");
$("#rendering377").hide();
$("#rendered377").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 editor377 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea377"), {
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);
}
}
});
editor377.on("change",function(doc){
if(!binded377){
$(window).bind('beforeunload',function(){
binded377 = true;
return "xxxx";
});
}
var newCode = doc.getValue();
code377 = newCode;
$("textarea#stepcodeTextarea377").val(newCode);
if(alreadyWriteCode377!=code377){
lastModifedTime377 = new Date().getTime();
$("#rendering377").show();
$("#rendered377").hide();
}
// alert(doc.getValue());
});
$(".CodeMirror").addClass("form-control");
// var editor377 = CodeMirror.fromTextArea(, {
// lineNumbers: true,
// styleActiveLine: true,
// matchBrackets: true,
// theme:"eclipse",
// });
editor377.on("change",function(doc){
// alert(doc.getValue());
});
$("#tryDiv377").hide();
});
$("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");
1. 双击选中单词
2. 三击选中整行
3. CTRL+F 查找
4. F8 全屏编辑,再次点击恢复
|
渲染中
渲染完成
|
代码高亮插件双击即可选中,不过部分同学反应,通过代码高亮插件复制的代码无法在IDEA里正常显示,这里提供TEXTAREA的方式,方便复制,谢谢
1. 自行完成练习
根据练习目标尽量自己实现代码效果,期间会碰到疑问,难题,和自己不懂的地方,这些都是必要的过程
2. 带着疑问查看答案
完成过程中,碰到无法解决的问题,带着疑问,查看答案,分析答案的解决思路
3. 查看答案讲解视频
依然有不明白的地方,点开视频讲解,带着疑问,听视频讲解有问题的部分
4. 再做一遍
理解后,再从头做一遍,把有疑问的地方都捋清楚
5. 总结
最后再总结一遍,总结思路,总结解决办法,以后遇到类似的问题,怎么处理
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
提问之前请登陆
|