I like that, thanks. And the x/y thing isn't confusing to me, but I've
actually gotten phone calls about it from people worried that someone is
hacking their computer as a result of them. I wish there was a way to
turn them off. I've resorted to wrapping the image in an anchor tag,
too, but then I can't use post-headers which seems to be the way to go.
I've never had that problem at other jobs or projects, though, just this
one. Oh well.
Thanks for the help, all! I'll take a look at those links you sent me,
too, tobie!
-- Dash --
Christophe Porteneuve wrote:
> I see two things that could help:
>
> 1) To use IDs indeed: just add an infix/suffix to your IDs, e.g.
>
> <td><img id="img_<?= $id ?>_edit" src="..." /></td>
> <td><img id="img_<?= $id ?>_delete" src="..." /></td>
>
> 2) Why create one click handler per image?! Leverage bubbling, and
> create a single, non-server-generated (bye-bye this convoluted use of
> AJAX!) handler at the table level, that uses Event.element(e) to check
> it's dealing with one of your images. Something like:
>
> Event.observe('yourTableId', 'click', function(e) {
> var elt = Event.element(e);
> if (elt.tagName != 'IMG')
> return;
> Event.stop(e);
> var data = elt.id.split('_');
> window.location.href = data[2] + '_site.php?id=' + data[1];
> });
>
> Notice you don't need the custom classes anymore...
>
> >From a more conceptual standpoint, this *doesn't* degrade gracefully:
> with no JS, those images are unclickable, and your functionality is
> lost. These should be <input type="image" /> in a <form>, and you could
> intercept the form's submission through JS to rewrite the request
> without those pesky x/y arguments that you find "confusing to users."
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---