PDA

View Full Version : Hand on hover of javascript onclick link



jundo12
05-21-2015, 03:46 PM
Is there a way to have a javascript onclick link, thusly



<script>function imageClick(url) {
window.location = url;
}</script>


onclick="imageClick('http://yahoo.com')

show the normal link hover element (pointing hand) for the cursor when the onclick link is hovered?

jundo12
05-21-2015, 04:13 PM
nevermind. solution was
.roundabout-in-focus {
cursor: pointer;

doh. :D

molendijk
05-21-2015, 04:18 PM
You could (also) do:

<script>
function imageClick(url)
{
window.location = url;
}
</script>

<a href="javascript: void(0)" onclick="imageClick('http://yahoo.com'); return false">yahoo</a>

jundo12
05-21-2015, 04:36 PM
thanks. well the problem i was having is that it is an image link in a 3d image carousel that would not let me use normal link html to make the image an image link, so i had to use the javascript onclick thing which doesn't generate a pointer cursor on its own.

molendijk
05-21-2015, 05:27 PM
I see. You could do <img style="cursor: pointer" onclick=...>, but your solution works fine too (and is better).