It's hard to say without knowing what it is you are doing..

I usually use @Script templates for most of my js logic as it allows me to
write javascript within a javascript friendly template for interacting with
components and doing other nice things like loops/ifs/etc...

The below statements seem to hint at doing some graphical things to table
rows when they are selected...If I was doing it I'd probably use css for the
majority of things, in combination with some sort of "onclick" event that
set an additional css class on the tr when clicked..(Like
"selected"...Something that would set all td backgrounds to whatever image
it is you want to be visible when a row is selected..)

On 9/10/06, Erik Johansson <[EMAIL PROTECTED]> wrote:

Hi Josh,

This is how I did it

The tag:
<div jwcid="@Any" element="div" id="ognl:'time$'+row+'$'+column"
class="scheduleClicked"
onclick="ognl:'javascript:switchClicked('+row+','+column+');return
false;'">

The javascript
function switchClicked(_row, _column){
    if(document.getElementById('time$'+_row+'$'+_column).className ==
'scheduleClicked'){
        document.getElementById('time$'+_row+'$'+_column).className =
'scheduleUnclicked';
    }
    else{
        document.getElementById('time$'+_row+'$'+_column).className =
'scheduleClicked';
    }
}

-erik

Josh Joy wrote:
> Hi All,
>
> I'm needing to generate unique ids to use in my
> javascript function
> calls? The closest thing I could find on google is
> something called
> "IdAllocator" though I couldnt find any helpful
> examples.
>
> I need to do something similar to the following where
> the first number
> changes, ie _1_1 for the first row and the for loop
> generates _2_1 for
> the second row...
>
> for loop generates
>
>     <td>
>         <img id="pic_1_1"
> onclick="changePic('1','1');" src="pic.jpg" />
>         <img id="pic_1_2    "
> onclick="changePic('1','1');" src="pic.jpg" />
>         <img id="pic_1_3"
> onclick="changePic('1','1');" src="pic.jpg" />
>     </td>
>
>     <td>
>         <img id="pic_2_1"
> onclick="changePic('2','1');" src="pic.jpg" />
>         <img id="pic_2_2"
> onclick="changePic('2','1');" src="pic.jpg" />
>         <img id="pic_2_3"
> onclick="changePic('2','1');" src="pic.jpg" />
>     </td>
>
>
> First I was thinking of using the @Any tag, though I'm
> not sure how to
> inject a counter id into the string?
>
> Thanks in advance,
> Josh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Reply via email to