beetle
08-23-2002, 04:07 PM
Hey everyone
I'm scrambling to become more familiar with OO concepts, and specifically applying them to my javascript. So, as part of my self-education, I'm messing with prototype. I've done, this, but get a "not supported method" error. <html>
<title>Prototype testing</title>
<head>
<script type="text/javascript">
TR.prototype.toggle = function() {
this.style.backgroundColor = 'red';
}
</script>
</head>
<body>
<table cellspacing="1">
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
</table>
</body>
</html>
I'm scrambling to become more familiar with OO concepts, and specifically applying them to my javascript. So, as part of my self-education, I'm messing with prototype. I've done, this, but get a "not supported method" error. <html>
<title>Prototype testing</title>
<head>
<script type="text/javascript">
TR.prototype.toggle = function() {
this.style.backgroundColor = 'red';
}
</script>
</head>
<body>
<table cellspacing="1">
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
<tr onMouseOver="this.toggle()"><td>1</td><td>2</td><td>3</td></tr>
</table>
</body>
</html>