| | |
tag that shows hand on mouseover
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2005
Posts: 60
Reputation:
Solved Threads: 4
I need a tag that doesn't go anywhere when I click on it but will show the little hand with index finger outstretched like I am hovering over the text teh tag applies to. I googled for a while, but could not find anything related to what I am looking for. I need this because I am writing a file that will execute a javascript function when I click on it, which will display some new information, so I want it to appear to the user that he/she is clicking on a link.
•
•
Join Date: Jul 2005
Posts: 60
Reputation:
Solved Threads: 4
Thanks for the reply, but I found something even better, and I am a little embarrassed that I forgot I could do this.
Much simpler. Only thing is I usually hate these links cause I always click links with my middle mouse button to open a new tab in firefox lol.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<a href="javascript:display_spaces()">Get spaces</a>
Much simpler. Only thing is I usually hate these links cause I always click links with my middle mouse button to open a new tab in firefox lol.
•
•
•
•
Originally Posted by hinde
Thanks for the reply, but I found something even better, and I am a little embarrassed that I forgot I could do this.
Much simpler. Only thing is I usually hate these links cause I always click links with my middle mouse button to open a new tab in firefox lol.JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<a href="javascript:display_spaces()">Get spaces</a>
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<span style="cursor: hand;">Text with Hand Icon</span>
If you're feeling sassy you could even tie that span to a class and add that to the CSS file to keep your code cleaner and more efficent. Using an anchor when not needed is ghetto!
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
The last suggestion is the best. An anchor tag with the href set to "#" will navigate to the TOP of the page when clicked, which isn't quite the same thing as "go nowhere".
Similarly, using an empty JavaScript is... well, silly, in my opinion.
So I second IAMMATT's suggestion: just style a normal element, such as span, to display the hand cursor.
However, here's my standard scold: When a user sees their cursor turn to a hand, they expect that clicking will DO SOMETHING, in particular, that they will navigate somewhere.
So, creating an element that gives the hand cursor but that does nothing, violates the User Model, which is very nearly always a bad, bad idea.
EDIT: I re-read your original post. You want a hyperlink that runs a Javascript when clicked, so the
Similarly, using an empty JavaScript is... well, silly, in my opinion.
So I second IAMMATT's suggestion: just style a normal element, such as span, to display the hand cursor.
However, here's my standard scold: When a user sees their cursor turn to a hand, they expect that clicking will DO SOMETHING, in particular, that they will navigate somewhere.
So, creating an element that gives the hand cursor but that does nothing, violates the User Model, which is very nearly always a bad, bad idea.
EDIT: I re-read your original post. You want a hyperlink that runs a Javascript when clicked, so the
<a href="javascript:myFunction();">Run your function</a> is the proper method for this. •
•
Join Date: Feb 2006
Posts: 50
Reputation:
Solved Threads: 1
Here is a whole thread on the matter with many alternatives:
http://www.expertsrt.com/phpBB2/view...d484e1acd201b5
I agree that using a dummy javascript call is best.
http://www.expertsrt.com/phpBB2/view...d484e1acd201b5
I agree that using a dummy javascript call is best.
Site admin at NetBulge.com, a place set out to improve the web 1 good article at a time :)
![]() |
Similar Threads
- DIV Help! (HTML and CSS)
- Blackout shows Net's fragility (Geeks' Lounge)
- IE and strange UL-tag Phenomena (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Javascript Help
- Next Thread: customized right-click menu based on id
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser bug calendar captchaformproblem cart close codes column cookies css date debugger decimal dependent design disablefirebug dom download element embed engine enter error events ext file firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover paypal pdf php player position post problem programming prototype redirect regex safari scale scriptlets scroll search security select software sql text textarea toggle unicode variables w3c website window windowofwords windowsxp






