1.jquery捕捉回車鍵:
$("html ").die().live("keydown",function(event){
if(event.keyCode==13){
//這裡加要處理的邏輯
}
} );
//綁定回車動作
$('textarea[name=chattext]').keydown(function(event){
if(event.which==13){
}
});
2.jquery取得多個選取的checkbox值:
$('input[type="checkbox"][name="types"]:checked').each(function() {
types = types $(this).val() "|";
}
);
3.jquery非同步請求的方法:
$.ajax({
url : "${pageContext.request.contextPath }/UOSRoleManangerAction.do?method=createRole",
type : "post",
dataType : "html",
data:{"roleName":roleName,"roleDescription":roleDescription,"roles" :roles,"types":types},
success : function(data){
var dataObj=eval("(" data ")");
if(dataObj.result){
alert("操作成功!");
submitForm(null,"initPage");
}else {
alert("操作失敗!");
}
}
});