我是靠谱客的博主 欣慰鸭子,这篇文章主要介绍小仙女-jquery 、ajax、jsp基础,现在分享给大家,希望可以做个参考。

jquery 、ajax、jsp基础

1、在JQuery能获取就能设置(对象设置)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function test1() { alert("11"); var username = $("#username").val(); alert("11"+username); username="Tom1"; alert("22"+$("#username").val()); alert("33"+username); $("#username").val("Tom2"); alert("44"+username); $("#username").val(""); alert("55"+username); }
2、removeArrt用法
复制代码
1
2
3
function test2(){ $("#picture").removeArrt("src"); }
3、attr用法

复制代码
1
2
3
4
5
function test3(){ alert($("#username").attr("type")); alert($("#username").attr("type","buton")); alert($("#username").attr("value")); }
4、设置字体样式
复制代码
1
2
3
4
5
function test4(){ alert($("#username").css("color"); }
5点击事件
复制代码
1
2
3
4
5
6
7
$(document).ready( function(){ $("#but1").click( function () { alert("11111"); }); } );
6、聚焦、失焦事件

复制代码
1
2
3
4
5
6
7
8
$(document).ready(function(){ $("input").focus(function(){ $("input").css("background-color","#FFFFCC"); }); $("input").blur(function(){ $("input").css("background-color","#D6D6FF"); }); });

7、select事件

复制代码
1
2
3
4
$(document).ready(function(){ $("input").select(function(){ $("input").after(" Text marked!"); });

8、keypress回车事件
复制代码
1
2
3
4
5
6
7
8
9
10
11
//回车 $(document).ready( function(){ $('#login').keypress( function(e){ if(e.keyCode==13){ alert("你点击了回车事件"); } } ); });
9、append 事件

复制代码
1
2
3
4
5
$(document).ready(function(){ $("button").click(function(){ $("p").append(" <b>Hello world!</b>"); }); });

复制代码
1
2
3
4
5
6
7
8
9
10
$(document).ready(function(){ $("#app1").click(function(){ $("<b> Hello World!</b>").appendTo("#pp"); }); }); <body> <p id="pp">I would like to say: </p> <input type="button" value="点我6" id="app1"/> </body>




10、:first事件

复制代码
1
2
3
4
5
function test5(){ alert($("li:first").text()); }

复制代码
1
2
3
$(document).ready(function(){ $("li:first").css("background-color","#B2E0FF"); });







11、:checked事件

复制代码
1
2
3
function test6(){ alert($("input:not(:checked)")); }

复制代码
1
2
3
4
5
$(document).ready(function(){ $(".btn1").click(function(){ $(":checked").hide(); }); });






12、:eq()事件

复制代码
1
2
3
4
5
function test7(){ alert($("tr:eq(1)")); }

13、checked事件

复制代码
1
2
3
4
5
6
function test8(){ alert($("input[name='newsletter']").attr("checked", true)); } function test9(){ alert($("div").children(".selected")); }

14、JSP中这样写才正确

{param.password1==param.password2}

15、jsp

jsp页面实际上是servlet
jsp中可以使用request和session
jsp和servlet优缺点
优 方便显示
jsp 
缺 不方便出来业务逻辑

优 方便出来业务逻辑
servlet
缺 不方便显示






jsp页面运行原理




最后

以上就是欣慰鸭子最近收集整理的关于小仙女-jquery 、ajax、jsp基础的全部内容,更多相关小仙女-jquery内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(106)

评论列表共有 0 条评论

立即
投稿
返回
顶部