<html>
<head>
<script type="text/javascript">
Function.prototype.of = function( o ){
var f = this;
return function(){
return f.apply( o, arguments );
};
};
function $( id ){
return typeof id == 'string' ? document.getElementById(id) : id;
}
function myclass(id) {
this.a = 5;
this.el = $(id);
this.el.onclick = this.onClick.of(this);
}
myclass.prototype.onClick = function(){
alert("change " + this.a + " " + this);
}
</script>
</head>
<body>
<button id="next">next</button>
<script type="text/javascript">
var mc = new myclass("next")
</script>
</body>
</html>