473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Dynamically changing image map using XML data

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 at
http://www.ilex-urc-maps.com/testing.html but I 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

Jun 6 '07 #1
7 3621
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.htmlbut I 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

Jun 6 '07 #2
pe**********@googlemail.com wrote:
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.htmlbut I 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.

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....
Number one thing I think of, is make it accessible at least with a
default "sorry this page requires JavaScript" example.

Anyway, to get more Internet Explorer-compatible, you need to can the
setAttributes in lieu of setting the attributes directly.

That was all I saw, but I didn't read in depth.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 7 '07 #3
On 7 Jun, 13:48, -Lost <maventheextrawo...@techie.comwrote:
petethebl...@googlemail.com wrote:
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.
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....

Number one thing I think of, is make it accessible at least with a
default "sorry this page requires JavaScript" example.

Anyway, to get more Internet Explorer-compatible, you need to can the
setAttributes in lieu of setting the attributes directly.

That was all I saw, but I didn't read in depth.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Thanks for taking a look.
I've had a bit of a hard time with it. I've used debugbar to get IE's
interpreted source and this works when copied and pasted into a new
document (with the Ajax bits removed, of course).
I'll try your tip about setAttribute tomorrow morning (it's GMT here).

Thanks again,
Pete

Jun 7 '07 #4
pe**********@googlemail.com wrote:
On 7 Jun, 13:48, -Lost <maventheextrawo...@techie.comwrote:
>petethebl...@googlemail.com wrote:
>>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.
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....
Number one thing I think of, is make it accessible at least with a
default "sorry this page requires JavaScript" example.

Anyway, to get more Internet Explorer-compatible, you need to can the
setAttributes in lieu of setting the attributes directly.

That was all I saw, but I didn't read in depth.
Thanks for taking a look.
I've had a bit of a hard time with it. I've used debugbar to get IE's
interpreted source and this works when copied and pasted into a new
document (with the Ajax bits removed, of course).
I'll try your tip about setAttribute tomorrow morning (it's GMT here).
I actually posted this at 9:01 AM EST, but it seems it never got sent.

"One more quick thing... does it make sense to have 36 separate images
when only *1* character changes?

I think you could easily turn that into an absolutely positioned DIV or
SPAN that changes the number on each request."

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 7 '07 #5
On 7 Jun, 17:42, -Lost <maventheextrawo...@techie.comwrote:
petethebl...@googlemail.com wrote:
On 7 Jun, 13:48, -Lost <maventheextrawo...@techie.comwrote:
petethebl...@googlemail.com wrote:
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.htmlbutIcan'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.
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....
Number one thing I think of, is make it accessible at least with a
default "sorry this page requiresJavaScript" example.
Anyway, to get more Internet Explorer-compatible, you need to can the
setAttributes in lieu of setting the attributes directly.
That was all I saw, but I didn't read in depth.
Thanks for taking a look.
I've had a bit of a hard time with it. I've used debugbar to get IE's
interpreted source and this works when copied and pasted into a new
document (with the Ajax bits removed, of course).
I'll try your tip about setAttribute tomorrow morning (it's GMT here).

I actually posted this at 9:01 AM EST, but it seems it never got sent.

"One more quick thing... does it make sense to have 36 separate images
when only *1* character changes?

I think you could easily turn that into an absolutely positioned DIV or
SPAN that changes the number on each request."

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Sorry. Should have been clearer. The images used at the moment are
just for testing. The eventual images used will be a full street map
of the city - there's a prototype at http://www.ilex-urc-maps.com/project...edcity_loc.htm
but we want to use Ajax to make the whole thing smooth and fast. I
just wish the popup images weren't part of the cunning plan!

Thanks again,

Pete

Jun 8 '07 #6
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>

Jun 8 '07 #7
On 8 Jun, 10:19, "petethebl...@googlemail.com"
<petethebl...@googlemail.comwrote:
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.htmlbutIcan'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>
Oops. Google Groups decided to post that message about 36 hours after
I wrote it.

FINAL update - and thanks to -Lost for the help.
I've changed element.setAttribute("onmouseover",....
to element.onmouseover=new Function()
and it works in FF and IE7.

I'm elated!

Pete

Jun 8 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: C A Upsdell | last post by:
I have a site where I am setting a style dynamically, using the JS statement: obj.style.backgroundImage = 'url(img/bak_page.jpg)'; where 'obj' is either document.getElementById(id), or...
9
by: pablo | last post by:
Dear NGers, I would like to change the alt-text with the changing of the image during a mouseover action. Can document.images.altView be changed dynamically? TIA, pablo
2
by: Paolo Pignatelli | last post by:
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show) -- <gallery timer="3" order="sequential" fadetime="2" looping="yes"...
3
by: SGA Smele | last post by:
Hello, Now I think that there is a simple answer to my problem, but I don't know what it is and I can't work out what I should be searching for on the internet to read up some more about it. ...
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
4
by: Chris Mahoney | last post by:
Hi Currently I am setting the background image of my page by using the following code: <style type="text/css"> BODY { BACKGROUND-IMAGE: url(myimage.jpg) } </style> What I would like to do...
2
by: Ken Varn | last post by:
I am using an HttpModule handler to dynamically stream out a JPEG image to an <img> control. It seems to work fine except for one thing. If I try to save the image in IE using the "Save...
5
by: Jerry Camel | last post by:
I am interacting with an OCX on the client side. In the Onload event of the page, I am checking a property of the OCX: Is the port open or closed. If the port is open, I want a certain image to...
6
by: ChrisAtWokingham | last post by:
I am creating a website using .Net v2.0 and c# and I have a problem with background images. I want to dynamically change the background image on the page, depending on data in the SQL database. ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.