two ways:
create a javascript function, not a js-object, thats called by "onclick" or create a javascript-object, with eventhandler that handles the onclick event like this Event.observe(this.fieldSetLegend, "click", this.toggle.bindAsEventListener(this)); Imants Firsts wrote: > > Hi! > > What is the correct way to use JavaScript in my > tapestry components? > If I use the code below, and my HTML has a button with > onclick="myObj.doSomething();", it can not find myObj. > > pageRenderSupport.addScriptLink(myLibrary); > pageRenderSupport.addScript("var myObj = new MyObj();" > > The problem is that my object is created in > Tapestry.onDOMLoaded() function and I can not access it > later. > > How to solve this? Is the only way is to pass the ID of > the button to the constructor of my object and add the > event handler to the button using Prototype? Is that > the best way? > > Merry Christmas, > Imants Firsts > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > ----- --- best regards Sven -- View this message in context: http://www.nabble.com/T5%3A-JavaScript-in-my-components-tp14480237p14480312.html Sent from the Tapestry - User mailing list archive at Nabble.com.