Skip to content

Instantly share code, notes, and snippets.

@jay16
Created December 16, 2013 08:00
Show Gist options
  • Save jay16/7983704 to your computer and use it in GitHub Desktop.
Save jay16/7983704 to your computer and use it in GitHub Desktop.
js获取对象所有方法与属性
<script src="http://solife.us/assets/jquery.js" type="text/javascript"></script>
<script>
$(function(){
$("svg path").on("click", function(e){
var obj = e.target;
var PropertyList='';
for(i in obj){
if(obj.i !=null)
PropertyList=PropertyList+i+'属性:'+obj.i+'\r\n';
else
PropertyList=PropertyList+i+'方法\r\n';
}
alert(PropertyList);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment