I'm building a webapp that opens a 'window' when you click on the image representing a user. It'll use ajax to get information from the database and display a profile.
Lightbox or something similar would be useful.
After browsing a bit I found this:
http://particletree.com/features/lightbox-gone-wild/
I don't have any preference at the moment for what I use, just that it's easy to implement and uses ajax to load rather than having to preload everything.
So on to the important question:
I know that if you use either event="return function();" or event="function(); return false;" then the original 'action' won't fire.
So if I have:
<a href="..." onclick="return function(this.href);">...</a>
Then that will work:
1. If Javascript is enabled and function() runs smoothly, it will use that and not go to the link.
2. If Javascript is not enabled or function() doesn't work (isn't compatible), then the link will activate.
That's simple enough and easy to work with.
But what happens when you have a much more complicated system with something like Ajax and lightbox where there are multiple elements that can fail?
It will be nice to not load a new page for most users, but it won't be a major problem if those without JS or limited JS must load a new page. That's the desired result.
The problem I'm worried about, though, is people who have limited JS and then do not get lightbox/ajax to work and see nothing AND then don't load the link.
So in summary:
For this script and in general, is it possible that something will go wrong and the JS will fail to properly execute but the original action will still be cancelled?



Reply With Quote
Bookmarks