<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="my.js"></script>
<script type="text/javascript" src="ts.js"></script>
<script type="text/javascript" src="jq.js"></script>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
alert($("p").text())
jQuery.say();
$("p").sayHello(
{name:"nihao",
age:90}
);
})
</script>
<p>zzzzzzzzz</p>
</body>
</html>javascript
1:jQuery.fn.sayHello=function(properties){
var defaults={ name:"張三",
age:20
};
jQuery.extend(defaults,properties);
alert("第一個參數:"+defaults.name+" 第二個參數"+defaults.age);
return this;
} html
2:(function($){//對象方法插件
var test={
say1:function(){
var k=$("p").text();
alert(k);
alert(k+"11111111111");
}java
}
;
var th={
defaults1:{
name:"張三",
age:20
},
init:function(){
var th=this.defaults1;
alert(th.name);
}
}
$(document).ready(function(){
test.say1();
th.init();
}
)
})(jQuery)
jquery
3:jQuery.fn.extend({ //對象方法
sayHello:function(){ alert("Hello");
},
sayBye:function(){ alert("Bye Bye");
}
});this
http://wenku.baidu.comhttp://wenku.baidu.com/link?url=lWnkf5fSQThJAh6nUuqaYrwQWo_EsiuSg2meEf19Jg0Hpi07sa9GPDhRJib2l1bLRcFvvdy-aQ7rPsS33r32oYymMHgiaibMl7tHRi_HvWe參考博客url