0

I have an image map that contains certain "Areas" that contain onmouseover events. Most of these events fire a function which passes in some coordinates. I want to be able to manipulate the coords in the function SFX_ShowIconOver.

The Image Map is created by a third party app so I can only manipulate rendered content.

<AREA onmouseover="SFX_ShowIconOver('Chart2','29456',368,10,22,22,false,this)" title="Legend Box" onclick="SFX_SendCommand('29456',false)" shape=rect coords=368,10,390,32>
hoakey
  • 998
  • 3
  • 18
  • 34

3 Answers3

0

Don't use inline javascript, change to the jQuery style, then change the variables a,b,c,d,e.

var a,b,c,d,e;
$('#area_id').mouseover(function() {
   SFX_ShowIconOver('Chart2', a, b, c, d, e, false,this);
}).click(function() {
   SFX_SendCommand(a, false);
});
xdazz
  • 158,678
  • 38
  • 247
  • 274
  • The function is created on the fly by a third party app. So I need some way of being able to locate this function "SFX_ShowIconOver" and manipulate its content. In fact the whole image map is created by a third party app. – hoakey Aug 17 '12 at 09:07
0

You could use JQuery to remove the onmouseover attributes from the DOM and then just add your own mouseovers using JQuery.

EDIT
have a look here. then all you would need to do is make sure that your 'overridden' function is declared after the 3rd party item is loaded.

Community
  • 1
  • 1
Qpirate
  • 2,078
  • 1
  • 29
  • 41
  • It's only the fourth parameter I want to change. Do you know how I would do this? – hoakey Aug 17 '12 at 09:33
  • @hoakey see my edit. you shouldn't need to do anything with JQuery in my edit. you are just overridding the JS function. – Qpirate Aug 17 '12 at 09:44
0

I managed to achieve what I wanted in the end. Here's the code:

            $("area").filter(function () { return this.outerHTML.match('SFX_ShowIconOver') })
        .each(function () {
            var pairs = $(this).attr("outerHTML").split(', ');

            for (var i = 0; i < pairs.length; i++) {
                var nums = pairs[i].split(',');
                nums[3] = 40;
                pairs[i] = nums.join(',');
            }

            $(this).attr("outerHTML", pairs.join(', '));
        });
hoakey
  • 998
  • 3
  • 18
  • 34