If you can put the A inside the TD, like the W3 would prefer, then  
this is probably very very solveable.

If you had this:

<td><a href="your/lightbox" rel="lightbox">I'm a Cell</a></td>

Then you could do something like this (further down the page, or  
wrapped in a document listener):

$$('a[rel~="lightbox"]').each(function(elm){
        var td = elm.up('td');
        td.observe('mouseover',function(){
                td.addClassName('over');
        });
        td.observe('mouseout',function(){
                td.removeClassName('over');
        });
        td.observe('click',function(evt){
                evt.stop();
                alert("Help! I've been clicked!");
        });
        elm.replace(elm.innerHTML);
});

And that should (untested) get you a td that responds to hover and  
click as if the entire thing was a link.

I am supposing here (since you were wrapping a td with a link in your  
HTML) that this is the behavior you want to simulate, and you can't  
use the much simpler CSS method:

td.lightbox a {
        display: block;
        height: whatever;
        width: whatever;
        margin: 0;
}

<td class="lightbox"><a href="blah">Click me click me</a></td>

Walter

On Sep 30, 2008, at 9:00 AM, josher565 wrote:

>
> The reason why I have an anchor around a td is because the client has
> specified to me they want to use one of these "lightbox"
> implementations. There's a bunch of unstandardized implementations out
> there, but they are quick and easy to use. For me, I'd prefer to use
> some form of prototype object that knew how to do the lightbox.
> Unfortunately, I don't have that leeway. So despite my quick and dirty
> example code, is there a quick and dirty way to do this. Code or
> comment is greatly appreciated.
>
> Josh
>
> On Sep 29, 5:11 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> There are several problems with that markup.  1. You use double  
>> quotes
>> in your JavaScript alert when the attribute is wrapped in double
>> quotes.  2. You don't have a closing double quote on something (hard
>> to say what, given #1).  3. <a> is not a valid child of <tr>.  That's
>> off the top of my head, there may be other problems.
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to