Results 1 to 9 of 9

Thread: Changing mouse cursor in image map

  1. #1
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Changing mouse cursor in image map

    Hi!
    I was wondering how to change the 'hand' cursor on an image map hotspot to a 'crosshair' using the area tags.
    I have the following code...and part of my css already points out to use the crosshair cursor but it doesn't work on the image map.

    Code:
    <img src="newhead.jpg" usemap="#mymap" border="3" alt="" width="700" height="340" /><br />
    <map name="mymap">
    <area shape="rect" coords="0,290,90,340" href="home.html" alt="Home">
    <area shape="rect" coords="90,290,140,340" href="bio.html" target="iframe" alt="Biography">
    <area shape="rect" coords="140,290,220,340" href="news.html" target="iframe" alt="Latest News">
    <area shape="rect" coords="220,290,320,340" href="gallery.html" target="iframe" alt="Gallery">
    <area shape="rect" coords="320,290,420,340" href="media.html" target="iframe" alt="Media">
    <area shape="rect" coords="420,290,520,340" href="http://z8.invisionfree.com/Adam_Scott" target="new" alt="Adam Scott Fan Forum">
    <area shape="rect" coords="520,290,600,340" href="links.html" target="iframe" alt="Links">
    <area shape="rect" coords="600,290,710,340" href="about.html" target="iframe" alt="About us">
    </map>
    any suggestions? thanks!
    Last edited by suwii; 12-05-2006 at 12:19 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The hand means "click this link" and has a special purpose. Changing it will confuse users.
    If an area (as defined by an area tag) has a link value to it, then it will change the cursor to a hand, helping the user know which areas s/he can click and which s/he cannot. The areas that do not have a link set will not turn it to a hand, which is a good thing.
    As for overriding that, not quite sure. I'd say just apply the code to change the cursor to the area, same as you would to an image, div, span, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yeah thanks for that!
    So how do you change the hand cursor within the area tag? Any specific instructions? thank you..

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    style="cursor:hand"... i think.
    there's a code on DD for it.

    Anyway, use the SAME method you're using for other stuff, but just in the <area ...> tag instead.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I tried it..and it didn't work
    anyone else got any suggestions? :P
    thanks djr33!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm... not sure.
    I just typed that from memory.
    I believe there are several scripts on this subject on in the DD library... take a look.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    YES!! just when i was about to give up hope..this comes along!!

    http://www.dynamicdrive.com/dynamicindex11/fcursor.htm

    yay! THANKS djr33! I had to use span tags!

  8. #8
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Below you can find something that achieves what you want. I've done it with the help of JavaScript.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Image Map Cursor Change</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript">
    function over(id, cursorVal)
    {
    document.getElementById(id).style.cursor = cursorVal;
    }


    function out(id)
    {
    document.getElementById(id).style.cursor = 'default';
    }


    </script>
    </head>
    <body>
    <div id='mapa'>
    <map name="mymap">

    <area href='http://www.google.com' onmouseover="over('mapa', 'crosshair');" onmouseout="out('mapa');" shape="rect" coords="284,161,391,181" >

    <area href='http://www.yahoo.com' shape="rect" coords="575,109,654,137" onmouseover="over('mapa', 'crosshair');" onmouseout="out('mapa');" >

    </map>
    <img border=0 src="Web/Javascript Object Model.jpg" usemap="#mymap">
    </div>
    </body>
    </html>
    The coordinates are based on the image on which i've worked. You can change them according to your needs .

    Important things noted in blue and red color

  9. #9
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Quote Originally Posted by suwii
    http://www.dynamicdrive.com/dynamicindex11/fcursor.htm
    I don't think simply using
    Code:
    <span style="cursor:pointer;cursor:hand">
    will help you because i've tried it first but got nothing.
    Last edited by codeexploiter; 12-05-2006 at 09:04 AM. Reason: some style information changed into smileys. changed now

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
  •