| 2:07 pm on May 28, 2010 (gmt 0)|
<a href="#" onclick="showdiv('fadedbg'); showdiv('popup'); return false;">My Tasks</a>
I assume you don't want to go anywhere so don't use href.
The "return false;" ensures the href is not actioned.
I assume you have some div's with id="fadedbg" and id="popup"
| 2:22 pm on May 28, 2010 (gmt 0)|
It works! Thank you for your help.
I made the changes that you suggested moving the function to onclick instead of href. You're right I don't need to go anywhere just display hidden divs on the page when the user clicks the link.
thanks for a quick reply :)
| 2:34 pm on May 28, 2010 (gmt 0)|
| 1:37 am on May 29, 2010 (gmt 0)|
<a href="document.href='google.com'">Bad Url</a>
There are sure to be some smart tricks where this useful, but not obvious to me.
| 5:49 pm on May 29, 2010 (gmt 0)|
You could do several things, here's a few:
- drop the href="" attribute <a onclick="showdiv('fadedbg'); showdiv('popup');">My Tasks</a>
- use span instead <span onclick="showdiv('fadedbg'); showdiv('popup');">My Tasks</span>
But of course, span tags don't have the nice :link, :visited, and :hover pseudo classes.
I always take advantage of <a> tags for this reason.
Since you're not actually navigating anywhere, the anchor tag <a> doesn't need the href="" attribute.
Here's an example:
Since I added "return true;" to your function, the onclick attribute is testing for "false".