Results 1 to 5 of 5

Thread: Hand on hover of javascript onclick link

  1. #1
    Join Date
    May 2014
    Posts
    203
    Thanks
    28
    Thanked 5 Times in 5 Posts

    Default Hand on hover of javascript onclick link

    Is there a way to have a javascript onclick link, thusly

    Code:
    <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?

  2. #2
    Join Date
    May 2014
    Posts
    203
    Thanks
    28
    Thanked 5 Times in 5 Posts

    Default

    nevermind. solution was
    .roundabout-in-focus {
    cursor: pointer;

    doh.

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    You could (also) do:
    Code:
    <script>
    function imageClick(url) 
    {
    window.location = url;
    }
    </script>
    
    <a href="javascript: void(0)" onclick="imageClick('http://yahoo.com'); return false">yahoo</a>

  4. #4
    Join Date
    May 2014
    Posts
    203
    Thanks
    28
    Thanked 5 Times in 5 Posts

    Default

    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.

  5. #5
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

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

Similar Threads

  1. How to change my hover effect with OnClick event
    By mikamakela in forum JavaScript
    Replies: 3
    Last Post: 12-02-2013, 03:18 PM
  2. Replies: 0
    Last Post: 10-10-2013, 07:20 AM
  3. arrow instead of hand on mouse-over link
    By chechu in forum Dynamic Drive scripts help
    Replies: 7
    Last Post: 09-21-2009, 02:45 PM
  4. Replies: 1
    Last Post: 07-04-2008, 01:50 PM
  5. Replies: 3
    Last Post: 08-21-2005, 07:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •