`
fuhuijun
  • 浏览: 30828 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

jQuery笔记

阅读更多
一:
$('input[sourceflag="1"]').each(function(i){//jQuery1.4以下版本input[@sourceflag="1"]
if($(this).attr("checked")==false){//不能使$(this).attr("checked")=='false'
	tag = false;
	return false;//不能使用break
	}
});

二:

 

 $("[name='checkbox']").attr("checked",'true');//全选

 $("[name='checkbox']").removeAttr("checked");//取消全选
 

 

三:关于jQuery动态提交form表单

      1、添加 jquery.js 和 jquery.form.js

      2、 如果提交后出现页面刷新,则有可能按纽type="submit"或"image"

 

四:jQuery EasyUI官网下载地址http://jquery-easyui.wikidot.com/download

 

五:jQuery  $.fn.extend()$.extend 的区别     javascript prototype 的用法

 

<%@ page language="java" pageEncoding="UTF-8"%>
<%String path = request.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" language="javascript" src="<%=path %>/script/siic/jquery.js"></script>
<script type="text/javascript">
/**prototype测试 */
function RP(){	
	RP.PropertyA=1;
	RP.MethodA=function(){
		alert("RP.MethodA");
	};

	this.PropertyA=100;
	this.MethodA=function(){
		alert("this.MethodA");
	};
}

RP.prototype.PropertyA=10;
RP.prototype.MethodA=function(){
	alert("RP.prototype.MethodA");
};

/** $.extend和$.fn.extend区别 */
(function($){					//==================//
	$.fn.showC=function(){		//========(A)========//
		alert("方法C");			//此处功能和B处一样,但是会被 //
	};						//B处覆盖,与方法定义逻辑位置 //
	$.fn.show=function(){		//有关,定义方法的时候根据自   //
		alert("common_3");		//己的习惯而定			   //
	};						//EG:  $("#A").show()         //
})(jQuery);					//==================//


$.fn.extend({                                   //==================//
	showA:function(){			//==========(B)======//
		alert("方法A");			//此处功能和A处一样,但是会覆 //
	},						//盖B处功能,与方法定义逻辑位 //
	show:function(){			//置有关,定义方法的时候根据   //
		alert("common_1");		//自己的习惯而定                   //
	}						//EG:  $("#A").show()         //
});							//==================//

$.extend({					//==================//
	showB:function(){			//========(C)========//
		alert("方法B");			//此处功能直接在jQuery对象中//
	},						//添加方法				   //
	show:function(){			//EG   $.show()			   //			
		alert("common_2");		//			          	   //	
	}						//==================//				
});

//测试
function check(){
	$("#method").showA();
	$("#method").showB();//$("#method").showB is not a function
	$.showB();
	$("#method").show();
	$.show();
}
</script>
</head>
<body>

	<script>
		var rp = new RP();
//		delete RP.PropertyA;
		alert(RP.PropertyA);
//		delete RP.MethodA;
		RP.MethodA();
//		delete rp.PropertyA;
		alert(rp.PropertyA);
//		delete rp.MethodA;
		rp.MethodA();
	</script>

<div id="method"><a href="#" onclick="check();">测试</a></div>
</body>
</html>
 

 

分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

Global site tag (gtag.js) - Google Analytics