jsp,jquery学习笔记



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

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

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

[html]   view plain  copy
  1. $(document).ready(function(){  
  2.             $("input").focus(function(){  
  3.             $("input").css("background-color","#FFFFCC");  
  4.              });      
  5.              $("input").blur(function(){  
  6.                  $("input").css("background-color","#D6D6FF");  
  7.             });  
  8.             });  

7、select事件

[html]   view plain  copy
  1. $(document).ready(function(){  
  2.             $("input").select(function(){  
  3.              $("input").after(" Text marked!");  
  4.              });  

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

[html]   view plain  copy
  1. $(document).ready(function(){  
  2.                 $("button").click(function(){  
  3.                 $("p").append(" <b>Hello world!</b>");  
  4.                  });  
  5.                 });  

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




10、:first事件

[html]   view plain  copy
  1. function test5(){  
  2.               
  3.               
  4.                     alert($("li:first").text());  
  5.             }  

[html]   view plain  copy
  1. $(document).ready(function(){  
  2.              $("li:first").css("background-color","#B2E0FF");  
  3.             });  







11、:checked事件

[html]   view plain  copy
  1. function test6(){  
  2.             alert($("input:not(:checked)"));  
  3.             }  

[html]   view plain  copy
  1. $(document).ready(function(){  
  2.              $(".btn1").click(function(){  
  3.              $(":checked").hide();  
  4.             });  
  5.             });  






12、:eq()事件

[html]   view plain  copy
  1. function test7(){  
  2.               
  3.               
  4.                 alert($("tr:eq(1)"));  
  5.             }  

13、checked事件

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

14、JSP中这样写才正确

{param.password1==param.password2}


15、jsp

jsp页面实际上是servlet
jsp中可以使用request和session
jsp和servlet优缺点
优 方便显示

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


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值