PHP Developers Network
http://forums.devnetwork.net/

Create an image map with tooltips
http://forums.devnetwork.net/viewtopic.php?f=50&t=76388
Page 1 of 1

Author:  Josh1billion [ Thu Nov 22, 2007 5:31 pm ]
Post subject:  Create an image map with tooltips


Author:  s.dot [ Thu Nov 22, 2007 5:42 pm ]
Post subject: 


Author:  Kieran Huggins [ Fri Nov 23, 2007 12:55 am ]
Post subject: 

looks cool, but you need to close your img tag!

Author:  Josh1billion [ Sat Nov 24, 2007 4:03 pm ]
Post subject: 

If anyone wants to see a working example, I have one temporarily uploaded.

Here's a screenshot:


Here's the working example, though you'll need to be logged into SoTO to use it (the imagemap isn't the only purpose of the page):
http://www.seedsoftime.net/worldmap.php

Note: the compass is one single image. No need to upload the image in different sections.

Author:  spikereloaded [ Fri Nov 25, 2011 7:23 pm ]
Post subject:  Re: Create an image map with tooltips

hi, im having trouble getting the tooltips to show on my image map. the code for the map is working fine but im not able to get the tooltips to appear. i know this is quite an old topic so will wait for a reply before posting any code! hope someone can help me!
spikereloaded

Author:  spikereloaded [ Sat Nov 26, 2011 12:43 pm ]
Post subject:  Re: Create an image map with tooltips

thought id post the code in case anyone passes through and has any idea why this wont work for me!
Syntax: [ Download ] [ Hide ]
<?php
include "globals.php";
?>
<head>
<style type="text/css">

#dhtmltooltip{
        position: absolute;
        width: 150px;
        border: 2px solid black;
        padding: 2px;
        background-color: lightyellow;
        visibility: hidden;
        z-index: 100;
/*Remove below line to remove shadow. Below line should always appear last within this CSS*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
}

</style>
</head>
<?php
Include "map_functions.php";
$q=$db->query("SELECT u.*,c.* FROM users u LEFT JOIN cities c ON u.location=c.cityid WHERE u.userid=$userid");
$r=$db->fetch_row($q);
$_GET['to'] = abs((int) $_GET['to']);
if(!$_GET['to'])
{
print "Welcome to the Monorail Station. It costs \$1000 for a ticket.<br> <u><b>Please be aware that you will still be charged if you choose to travel to a location that you are already in. <br>You are Currently in {$r['cityname']}</b></u></br> <br />
Where would you like to travel today?<br />"
;
$q=$db->query("SELECT * FROM cities WHERE cityid != {$ir['location']} AND cityminlevel <= {$ir['level']}");
//code for the imagemap
map_Start("http://murdercountry.com/murdercountrymap.jpg");

        map_Entry("This is one place on the map", "white", 98, 496, 10, 10, "monorail.php?to=1", 500);
                map_entry("This is Thugville", "white", 141, 200, 10, 10, "monorail.php?to=2", 150);
                map_entry("This is Gangsterville", "white", 218, 49, 10, 10, "monorail.php?to=3", 150);

        map_End();
               
                //end code for imagemap
while($r=$db->fetch_row($q))
{

}

}
else
{
if($ir['money'] < 1000)
{
print "You don't have enough money.";
}
else if( ((int) $_GET['to']) != $_GET['to'])
{
print "Invalid city ID";
}
else
{
$q=$db->query("SELECT * FROM cities WHERE cityid = {$_GET['to']} AND cityminlevel <= {$ir['level']}");
if(!$db->num_rows($q))
{
print "Error, this city either does not exist or you are not a high enough level to go there.";
}
else
{
$db->query("UPDATE users SET money=money-1000,location={$_GET['to']} WHERE userid=$userid");
$r=$db->fetch_row($q);
print "Congratulations, you paid \$1000 and travelled to {$r['cityname']} on the monorail!";
}
}
}
$h->endpage();
?>
<body>
<div id="dhtmltooltip"></div>
<script type="text/javascript" src="tooltip.js"></script>
</body>

Author:  spikereloaded [ Sun Nov 27, 2011 9:37 am ]
Post subject:  Re: Create an image map with tooltips

no wories sorted it. Had to put the Script in the header of the actual page rather than putting it in a seperate .js file.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/