js object写法 参数传递jquery对象
<!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>无标题文档</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function(){
var ac = {
name : 'myname',
age : 28,
run : function (jqObj) {
var $obj = jqObj || $();
alert($obj.html());
$obj.parents(".main").find("span").hide();
},
got : function(){
alert("got");
}
}
var bb={
run:function(){alert(2222)}
}
$(".aa").live("click",function(){
ac.run($(this));
ac.got();
bb.run();
})
})
</script>
</head>
<body>
<div class="main fe_sss">
<span>ssssssssssssssss</span>
<div class="aa" style="width:120px; height:30px; cursor:pointer; margin:20px auto; background:#990">按键上空间爱</div>
</div>
</body>
</html>