Can anybody tell why the new object creating method don't work in my test code? The "old" way seems working just ok.
The prototype framework is 1.7.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="application/javascript">
<!--
/* obsolete syntax, working just fine. */
var ProgressBar1 = Class.create();
ProgressBar1.prototype =
{
initialize: function(Container) {
this.Container = Container;
},
showProp: function() {
alert(this.Container);
}
};
/* new syntax, not working? */
var ProgressBar2 = Class.create({
initialize: function(Container) {
this.Container = Container;
},
showProp: function() {
alert(this.Container);
}
});
-->
</script>
</head>
<body>
<div id="progBar1"></div>
<div id="progBar2"></div>
<script type="application/javascript">
<!--
var progress1 = new ProgressBar1($("progBar1"));
var progress2 = new ProgressBar2($("progBar2"));
progress1.showProp();
progress2.showProp();
-->
</script>
</body>
</html>
Am i really that stupid 'cause i don't find error in this snippet...
Olli.
The prototype framework is 1.7.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="application/javascript">
<!--
/* obsolete syntax, working just fine. */
var ProgressBar1 = Class.create();
ProgressBar1.prototype =
{
initialize: function(Container) {
this.Container = Container;
},
showProp: function() {
alert(this.Container);
}
};
/* new syntax, not working? */
var ProgressBar2 = Class.create({
initialize: function(Container) {
this.Container = Container;
},
showProp: function() {
alert(this.Container);
}
});
-->
</script>
</head>
<body>
<div id="progBar1"></div>
<div id="progBar2"></div>
<script type="application/javascript">
<!--
var progress1 = new ProgressBar1($("progBar1"));
var progress2 = new ProgressBar2($("progBar2"));
progress1.showProp();
progress2.showProp();
-->
</script>
</body>
</html>
Am i really that stupid 'cause i don't find error in this snippet...
Olli.