| | |
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: database application on cd
Views: 15120 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta box browser bug button calendar captchaformproblem card checkbox child class close cookies createrange() cursor dependent disablefirebug dom dropdown editor element engine events explorer ext file firehose flash form forms game google gwt gxt highlightedword html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump margin math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post progressbar rated regex runtime scroll search session shopping size solutions sql star stars stretch synchronous text textarea twitter validation web website window windowofwords windowsxp wysiwyg xml xspf \n






