Все та же карта Jquery
http://www.codenet.ru/webmast/js/world-map/
Подскажите, как пользоваться обработчиком "overandler", чтобы при наведению на страну писалось ее название, к примеру на беларусь писало тултип "Беларусь".
Спасибо!
Цитата: Demias
Неужели невозможно?
Неужели подумать сложно?
Код:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://www.codenet.ru/np-includes/upload/2011/04/28/130861.js"></script>
<style type="text/css">
.worldmap {fill:white;stroke:black;stroke-width:0.5px;}
.worldmap:hover {fill:#e0e0e0;stroke:black;stroke-width:0.5px;}
.worldmap_1 {fill:#f08080;stroke:black;stroke-width:0.5px;}
.worldmap_1:hover {fill:#ff0000;stroke:black;stroke-width:1px;}
.worldmap_2 {fill:#8080f0;stroke:black;stroke-width:0.5px;}
.worldmap_2:hover {fill:#0000ff;stroke:black;stroke-width:1px;}
</style>
<script type="text/javascript">
function SetValues(e)
{
var e = e || window.event;
var hint=document.getElementById('countryhint');
hint.style.left=(e.clientX+20)+"px";
hint.style.top=(e.clientY+20)+"px";
}
document.onmousemove=SetValues;
</script>
</head>
<body>
<div id="worldmap" width="640" height="400" style="overflow:hidden;"></div>
<div id="countryhint" style="position:absolute; left:0px; top:0px; background-color:#D0D0D0; display:none;" >oO</div>
<script type="text/javascript">
function countryover(tld) {
var hint=document.getElementById('countryhint');
hint.innerHTML=tld;
hint.style.display="";
}
function countryout(tld) {
var hint=document.getElementById('countryhint');
hint.innerHTML="oO";
hint.style.display="none";
}
function countryclick(tld) {
alert(tld);
}
var map=new WorldMap({
element : 'worldmap',
width : 640,
height : 400,
overhandler : 'countryover',
outhandler : 'countryout',
clickhandler :'countryclick',
c : {BY:2,DE:2,RU:1,CA:1}
});
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://www.codenet.ru/np-includes/upload/2011/04/28/130861.js"></script>
<style type="text/css">
.worldmap {fill:white;stroke:black;stroke-width:0.5px;}
.worldmap:hover {fill:#e0e0e0;stroke:black;stroke-width:0.5px;}
.worldmap_1 {fill:#f08080;stroke:black;stroke-width:0.5px;}
.worldmap_1:hover {fill:#ff0000;stroke:black;stroke-width:1px;}
.worldmap_2 {fill:#8080f0;stroke:black;stroke-width:0.5px;}
.worldmap_2:hover {fill:#0000ff;stroke:black;stroke-width:1px;}
</style>
<script type="text/javascript">
function SetValues(e)
{
var e = e || window.event;
var hint=document.getElementById('countryhint');
hint.style.left=(e.clientX+20)+"px";
hint.style.top=(e.clientY+20)+"px";
}
document.onmousemove=SetValues;
</script>
</head>
<body>
<div id="worldmap" width="640" height="400" style="overflow:hidden;"></div>
<div id="countryhint" style="position:absolute; left:0px; top:0px; background-color:#D0D0D0; display:none;" >oO</div>
<script type="text/javascript">
function countryover(tld) {
var hint=document.getElementById('countryhint');
hint.innerHTML=tld;
hint.style.display="";
}
function countryout(tld) {
var hint=document.getElementById('countryhint');
hint.innerHTML="oO";
hint.style.display="none";
}
function countryclick(tld) {
alert(tld);
}
var map=new WorldMap({
element : 'worldmap',
width : 640,
height : 400,
overhandler : 'countryover',
outhandler : 'countryout',
clickhandler :'countryclick',
c : {BY:2,DE:2,RU:1,CA:1}
});
</script>
</body>
</html>
Неужели невозможно?
overhandler