<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
<script type="text/javascript">
window.onload = function(){
initCall();
}
function initCall(){
function User(name,age){
this.name = name;
this.age = age;
}
User.prototype = {
showName : function(){
alert(this.name);
},
showAge : function(){
alert(this.age);
},
showNumbers : function(numbers){
numbers.sort(function(a,b){
if(a > b){
return 1;
}else if(a < b){
return -1
}else{
return 0;
}
});
return numbers;
}
}
$("input").bind("click",function(){
var user = new User("Jack","25");
user.showName();
user.showAge();
var arry = [8,4,56,74,96,12,45,3,1,54];
alert(user.showNumbers(arry));
});
}
</script>
</head>
<body>
<input type="button" value="查看数据" />
</body>
</html