On 6 Jun, 17:09, "petethebl...@googlemail.com"
<petethebl...@googlemail.comwrote:
On 6 Jun, 16:23, "petethebl...@googlemail.com"
<petethebl...@googlemail.comwrote:
Can anyone help? I have a client who has made a "dynamic interactive
map" of our city using Dreamweaver. Each map file has hotspots that
pop-up a div with a little image when the mouse goes over them. They
also link to another file.
I've converting the application to a PHP-AJAX system athttp://www.ilex-urc-maps.com/testing.htmlbutI can't get the
dynamically altered hotspots to work.
Any ideas? Please don't tell me that the client should not use image
maps - that's not an option at this stage.
Thanks
Pete
UPDATE
I seem to have it working in Firefox. Now just have to fix it in the
other browser.
Still be glad of any help....
Pete
UPDATE NUMBER 2
Got it working mostly. Still some tidying to do in IE. If anyone cares
here's a section of code...
var root = myDocument.getElementsByTagName('mapfile')[0];
var filename = root.getAttribute("filename");
var width = root.getAttribute("width");
var height= root.getAttribute("height");
var hotspotList = myDocument.getElementsByTagName('Hotspot');
//code here for hotspots
//each hotspot looks like this....
//<area shape="poly" coords="" href="" alt="" title=""
onMouseOver="MM_showHideLayers('id','','show')"
onMouseOut="MM_showHideLayers('id','','hide')">
//<Hotspot coordinates="202,199,251,200,251,249,200,250"
popupFile="test.gif" link="fred" title="fred.html" y="100" x="100"/>
//clear map if it exists already
delete spotForHots;
var spotForHots;
var oldmap=document.getElementById("mainMapMap")
if(oldmap!=null){
//document.body.removeChild(oldmap);
// remove all children from element
var element = document.getElementById("mainMapMap");
while (element.firstChild) {
element.removeChild(element.firstChild);
}
spotForHots=element;
}
else{
spotForHots=document.createElement("map");
spotForHots.setAttribute("name","mainMapMap");
spotForHots.setAttribute("id","mainMapMap");
}
for(var x=0;x<hotspotList.length;x++){
var hotspot=document.createElement('area');
hotspot.setAttribute('shape','poly');
hotspot.setAttribute('coords',hotspotList[x].getAttribute("coordinates"));
hotspot.setAttribute('href',hotspotList[x].getAttribute("link"));
hotspot.setAttribute('title',hotspotList[x].getAttribute("title"));
hotspot.setAttribute('alt',hotspotList[x].getAttribute("title"));
hotspot.setAttribute('onMouseOver','MM_showHideLay ers(\'layer'+ x
+'\',\'\',\'show\')');
hotspot.setAttribute('onMouseOut','MM_showHideLaye rs(\'layer'+ x
+'\',\'\',\'hide\')');
spotForHots.appendChild(hotspot);
//add layers and images
var layer=document.createElement('div');
layer.setAttribute('id','layer'+x);
layer.setAttribute('style','position:absolute;left :'+hotspotList[x].getAttribute("x")
+'px;top:'+hotspotList[x].getAttribute("y")+'px;width:94px;height:
110px;z-index:1;visibility:hidden;');
var pic=document.createElement('img');
pic.setAttribute('src',hotspotList[x].getAttribute("popupFile"));
layer.appendChild(pic);
document.body.appendChild(layer);
}
document.body.appendChild(spotForHots);
//code for popups looks like this
//<div id="first" style="position:absolute; left:288px; top:254px;
width:94px; height:110px; z-index:1; visibility: hidden;"><img src="../
images/sml_derrypreschurch_8560.jpg" width="150" height="194"></div>