取出js對象的所有屬性的方式


例子:

//取出事件的所有屬性
		$('#id_btn').bind("click dbclick mouseout",{crdx:'我是傳的值'},function(e){
			var url = e.currentTarget.baseURI;
			var glo_filedValue = null;
			//遍歷event事件對象的所有屬性
			for(var field_ in e){
				
				glo_filedValue += '屬性'+field_+":"+e[''+field_]+'\n';
				console.log(glo_filedValue);
			}
			//把取出來的屬性全都放在<input type="text" id="theText" />中
			$('#theText').attr('value',glo_filedValue);
			
			alert('event.data.屬性:'+e.data.crdx);
			if(e['type']=='click'){
				if($(this).attr('disabled')!='disabled'){
				   $(this).attr('disabled','disabled');
				}
			}else if(e['type']=='mouseout'){
				console.log('---mouseout---');
			}
			
		});

  

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM