Are you using jQuery?
All of these functions have a pretty easy syntax in JQuery.
Check out the "getting started' stuff on the site http://www.jquery.com
It will help tremendously. Easy click binding, easy appending, chaining.
You will like it.
Glen
On 7/31/07, tsvikt <[EMAIL PROTECTED]> wrote:
>
>
> hi,
>
> in the code below: how do I get the function showText
> to see the object button bb?
>
> all I get in the alert is "undef"
>
> please help :(:(:(:(:(
>
> <html>
> <head>
> <script lnguage="javascript">
>
> function startHere() {
> var mt = new ttt();
> document.body.appendChild(mt._contentDiv);
> }
>
> function ttt() {
> this.name='myTest';
> this.bb = document.createElement('button');
> this.bb.innerText = 'Click Me';
> this.bb.attachEvent('onclick', this.showText);
> this._contentDiv = document.createElement("div");
> this._contentDiv.appendChild(this.bb);
> }
>
> ttt.prototype.showText = function() {
> alert(this.bb);
> }
>
> </script>
> </head>
>
> <body onload="startHere()">
> test
> </body>
> </html>
>
>