Javascript对象,表现方式一:

  person = new Object();
person.firstname = "An";
person.lastname = "na";
person.age = 12;
alert(person.age);

Javascript对象,表现方式二:

  function person(firstname, lastname, age) {
this.firstname = firstname;
this.lastname = lastname;
this.age = age;
}
var newPerson = new person("An", "na", 12);
alert(newPerson.firstname)

Javascript对象,表现方式三:

  var    person = { firstname: "An", lastname: "na", age: 12 };
alert(person.firstname);

Jquery扩展简单,简单应用如下:

 <!DOCTYPE html>

 <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
//jquery 扩展:
jQuery.extend({
my: function () {
alert("初试jquery扩展");
}
})(jQuery);
//使用:
$.my(); //jquery对象扩展:
jQuery.fn.extend({
self: function () {
alert("jquery对象扩展");
}
})
//使用:
$("span").self();//需要用对象.
</script>
</head>
<body>
<span>jquery对象扩展</span>
</body>
</html>

...以上为个人学习所写,可能不完整,欢迎补充...

05-02 03:46