小仙女-jquery 、ajax、jsp基础

来源:互联网 发布:帝国cms 火车头采集 编辑:程序博客网 时间:2024/04/27 15:23

jquery 、ajax、jsp基础

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

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用法
function test2(){$("#picture").removeArrt("src");}
3、attr用法

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

$(document).ready(function(){  $("input").focus(function(){    $("input").css("background-color","#FFFFCC");  });  $("input").blur(function(){    $("input").css("background-color","#D6D6FF");  });});

7、select事件

$(document).ready(function(){  $("input").select(function(){    $("input").after(" Text marked!");  });

8、keypress回车事件
//回车$(document).ready(function(){$('#login').keypress(function(e){if(e.keyCode==13){alert("你点击了回车事件");}});});
9、append 事件

$(document).ready(function(){  $("button").click(function(){    $("p").append(" <b>Hello world!</b>");  });});

$(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事件

function test5(){alert($("li:first").text());}

$(document).ready(function(){    $("li:first").css("background-color","#B2E0FF");});







11、:checked事件

function test6(){alert($("input:not(:checked)"));}

$(document).ready(function(){  $(".btn1").click(function(){    $(":checked").hide();  });});






12、:eq()事件

function test7(){alert($("tr:eq(1)"));}

13、checked事件

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页面运行原理




原创粉丝点击