Code (This is how the code looks like based on the configuration above. It can be copied and pasted directly into your project):
<html>
<head>
<title>SiteWatch API Example Viewer</title>
<script src='http://kort.samsyn.is/api/SiteWatch.aspx?v=2&key=your_keycode' type='text/javascript'></script>
<script type='text/javascript'>
//A map object variable.
var map;
//Event listener function.
function mousemoveChange(map, e) {
document.getElementById('mouseMove').innerHTML =
'<b>X:</b> ' + Math.round(e.mCoords.x) + ' <b>Y:</b> ' + Math.round(e.mCoords.y);
};
//Create a map object.
function InitMap() {
map = SWMap.create('map',
{ panButton: false, zoomButton: false,
defaultZoom: 7, defaultCenterPoint: { x: 359583, y: 406481 }
});
//Add an event listener to a function. See above.
map.addListener('mousemove', mousemoveChange, this);
};
</script>
</head>
<body onload='InitMap()'>
<span id='mouseMove'></span>
<div id='map' style='height:300px; width:600px;'></div>
</body>
</html>
|