Using MochiKit.DOM I'm creating a MAP node which contains a list of
AREA nodes. While it works for IE it seems that when the MAP is
created in Firefox not all of my attributes make it into the DOM. Is
there something extra I need to do for this to work in Firefox?
Here is my code in which I am generating the MAP and AREA nodes from a
file containing JSON formatted area IDs and coords:
var AREA = createDOMFunc('area');
var MAP = createDOMFunc('map');
function foo(a) {
sa = new Array();
sa = a[0].split(',');
var str = sa[1]+','+sa[2]+','+sa[3]+','+sa[4];
var mofooStr = 'mofoo(\''+sa[0]+'\')';
var mobarStr = 'mobar(\''+sa[0]+'\')';
return
AREA({'id':sa[0],'shape':'rect','coords':str,'onmouseover':mofooStr,'onclick':mobarStr});
}
function loadImageMapCallback(result) {
a = new Array();
var newImageMap = MAP({'id':'tmMap'},map(foo,result.areas));
swapDOM('tmMap',newImageMap);
}
function loadImageMapErrback(err) {
alert('Problem loading image map');
}
function loadImageMap() {
var d = loadJSONDoc("map.json");
d.addCallback(loadImageMapCallback);
d.addErrback(loadImageMapErrback);
}
**********
The map.json file looks something like:
{
"areas": [
["1,2,18,21,39"],
["2,2,40,21,60"],
["3,2,61,21,81"],
["4,2,82,21,102"],
["5,2,103,21,122"],
...
]
}
*********
After the loadImageMap method is called in IE I'm assuming the AREA
nodes look something like:
<AREA id="5" shape="rect" coords="2,103,21,122"
onmouseover="mofoo('5')" onclick="mobar('5')"/>
because I can mouseover and click on my image and I see the expected
calls to mofoo and mobar.
In Firefox I can examine the HTML (using firebug...way cool! Is there
something like firebug for IE?) and my AREA nodes sadly look like
this:
<area id="5" shape="rect" coords="2,103,21,122"/>
My onmouseover and onclick attributes are missing. Is this a known
problem or a side effect? Is there a better approach?
Thanks in advance!
Evan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---