Thiago,
yes, I know about ComponentResources.createXXXLink(), but how do I sneak it into the JavaScript? I guess I have to generate some special java script in afterRender. I'm sure I saw code like in the WIKI.

Ciao,
Jonathan

On 10/02/2009 01:22, Thiago H. de Paula Figueiredo wrote:
Em Mon, 09 Feb 2009 21:09:06 -0300, Jonathan O'Connor <ninki...@eircom.net> escreveu:

Thiago,

Hello, Jonathan!

I am most impressed with Prototype. I really like using $$().

Me too. As I can see, you quickly learned enough Prototype in a couple hours to do what you needed. :)

Here's my code to add onmouseover, onmouseout and onclick handlers for a zebra striped table. Unfortunately, I have to support IE6, so I couldn't use :hover for the mouse over/out handlers.

In other thread in this mailing there were people complaining about Internet Explorer. Add me to the list of IE haters. :(

On the other hand, we thank you for sharing your code with us. :) What about adding this to the Tapestry wiki?

Just one little Prototype advice: instead of using "this" to refer to the HTML element passed as an argument, use the first parameter (typically named "e"). Instead of doing this.className = "something", you can use e.addClassName("something"). All elements returned by Prototype are extended. This means that they have all methods listed here: http://www.prototypejs.org/api/element. This will make your Javascript code a little more elegant. ;) Something like (not tested):

$$('#customerTable tbody tr.DataTableEntryEven').each(function(elmt) {
          Event.observe(elmt, 'mouseover', mouseover);
          Event.observe(elmt, 'mouseout', function(ev) {
              ev.addClassName('DataTableEntryEven'); // <--- example here
          });
      });

     var click = function(e) {
// This location is sadly hardwired into the code - not very nice :-( window.location.href='/onlinebanking-biwvp/CustomerSearch.customerId/' + this.cells[1].textContent;
     };

Use ComponentResources.createXXXLink() to create the link for you. ;)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to