I created a sample script to illustrate what I am doing and to use to
test with... This is actually part of a tabbed pop box I created, but
just easier to share this way. Obviously, the JSON call won't work,
but you can get an idea of what I am doing...

------------------------------

Event.observe(window, 'load', function() {

        new Ajax.Request('json/geo.cfm?
week=49&year=2008&product=34&location=0&method=getGeoMapZones&box=4920081084034&tab=2&parent=content_4920081084034_2',
{
                method:'get',
                onSuccess:function(transport){
                        var jsonData = transport.responseText.evalJSON();
                        createMap(jsonData.DATA.SUMMARY);
                },
                onFailure:function(transport){
                        alert('error! '+transport.status);
                }
        });

});

function createMap(r) {

        var data = r.data;

        var mapHolder = 'mapHolder';
        var mapId = 'imagemap';

        //      <map name="m_index" id="m_index">
        var imapEl = new Element('map',{'name':mapId,'id':mapId});
        var t;

        for(t=0;t<r.recordcount;t++){

                //<area shape="poly" coords="" href="#" title="Zone 8" 
alt="Zone 8" /
>
                var mapArea = new Element('area',{'id':data.zone_id
[t],'shape':'poly','coords':data.zone_coords
[t],'href':'#','title':data.zone_name[t],'alt':data.zone_name[t]});

                imapEl.appendChild(mapArea);

        }

        $(mapHolder).appendChild(imapEl);

        var mapImage = new Element('img',{'src':'images/components/world-
map.gif','name':'geo','width':'600','height':'318','usemap':'#'+mapId});

        $(mapHolder).appendChild(mapImage);

}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to