Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: Map Area

  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Map Area

    This isn't for a site or anything a friend of mine likes to through scripts at me to get my skills up but this got me big time. Basically I'm supposed to add an image to the map area using javascript, here's the code:

    Code:
    <html>
    <head>
    	<title>Good Luck - hahaha</title>
    </head>
    <style type="text/css">
    	#map_stuff .mapper {background-image:url(someImage.gif)}
    </style>
    
    
    <body>
    <div id="map_stuff">
    <div id="1" class="mapper" >
    	<map id="this_map" name="this_map">
    		<area id="a" shape="circle" coords="139,58,31" title="" href="somePHPsite.php" />
    	</map>
    </div>
    </div>
    
    </body>
    </html>
    I have to put and image into the map and remove any other images.... any help would be appreciated.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    This friend wouldn't happen to be an instructor at some school, would he?

    Those are terribly vague requirements. How big an image? Where?

    And what "other images"? There are none shown there.

    That code you show there would seem to indicate that the image removal/addition should take place in PHP code, since the HREF is pointing to a PHP page.

    So are you supposed to do this in PHP or in JavaScript??

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,292
    Thanks
    10
    Thanked 583 Times in 564 Posts
    you add map areas to images, not the other way around.
    This must be done by hand, not by a script.

    How would a script know what areas of an image are to link to what server?

    It needs a human touch, unless you are talking very primitive images, and even then you really don't want to do image processing in javascript, you won't have much luck.

    @old pendant:
    This is a client-side image map, the href indicates to the server the portion of the image that was clicked.
    examples include click on faces in a crowd for more info on him, choose your country, etc...

    If i understand the OP, i think he wants to define additional clickable regions to an existing image tag.
    While javascript certainly can create those connections using the DOM, i don't see from what info it would do so.
    Last edited by rnd me; 05-14-2009 at 12:27 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Yes, I know it's a client side map. And my comment was *specifically* because of the HREF in there; when he clicks on that area it's going to go back to that page on the server. So he *could* then produce an entirely new page via PHP and send it back, with different images. Clumsy and slow, but it could be done that way.

    But I'm sure that's not what his instructor is after. Excuse me, his friend.

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,292
    Thanks
    10
    Thanked 583 Times in 564 Posts
    yes, if he were on the same domain.

    But server-side image maps are frowned upon for accessibility, so it would be better to return only a sucsess message, and rebuild the map client-side.

    just my $0.02
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,133
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    100% agreed. I just don't think he yet knows what he needs.


  •  

    Posting Permissions

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