When you have an a tag with an href, if that tag fires, it's a signal to the browser to begin unloading the page. When you use:
Code:
<a href="javascript:whatever();" . . .
That process (unloading the page) starts. If there is no actual link there (as is the case with
javascript:), the page won't change, but some things that might ordinarily happen before page unload begins (like submitting a form) will be skipped. This varies by browser. Other undesirable things can happen as well, though usually nothing bad happens. That's why it's still used so much.
Oddly enough, if you do use an onclick event that returns false as clueful instructs, you can use the the:
Code:
<a href="javascript:whatever();" . . .
too because it will be skipped. The only reason for doing so at that point is so that browsers that show the href in the status bar or elsewhere on hover of the link will have something to report to the user.
So you could do:
Code:
<a href="javascript:setAndSubmit('2010-07-09', '2010-07-09');" onclick="setAndSubmit('2010-07-09', '2010-07-09');return false;">Today</a>
That way the user will get an idea what clicking on the link will do before they click on it. But, since it won't fire anyway, you can tailor it more for informational purposes, like:
Code:
<a href="javascript:view(Today);" onclick="setAndSubmit('2010-07-09', '2010-07-09');return false;">Today</a>
Bookmarks