Use dojo to create class
<html>
<head>
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/"
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script>
function FirstName() {
var firstName = "A";
this.getFirstName = function() {
return firstName;
}
}
function LastName() {
var lastName = "F";
this.getLastName = function() {
return lastName;
}
}
dojo.declare("com.java2s.AnotherClass", [ FirstName, LastName],
{ middleName : "W",
getMiddleName : function() {
return this.middleName;
}
}
);
var o = new com.java2s.AnotherClass();
alert(o.getFirstName() + " " + o.getMiddleName() + " " + o.getLastName());
</script>
</head>
<body></body>
</html>
Dojo-toolkit.zip( 3,849 k)Related examples in the same category