return attr onmouseoout

return attr onmouseoout

Hi,

I'm new to JQuery, so please be patient ;-)

My problem is, that I'm getting links from a CMS in that way:

<a href="#" onmouseover="over('img4_95e4_0');" onmouseout="out('img4_95e4_0');" id="link_mainwindow_center_content_01"><img src="..." name="img4_95e4_0" id="link_mainwindow_center_content_01_img" /></a>


The img-name and the onmouseover and -out and also the img src are generated dynamically.

SO what I want to do is: on clicking the link with id "link_mainwindow_center_content_01" the onmouseover and -out should be removed (worked so far with attr(); ). But as soon as clicking "link_mainwindow_center_content_02" these two attributes should be the same again as they were before.

And that is, what I can't do - because as soon as I try to return the "onmouseout"-value (f.e.), i only get "undefined". I even tried to get that value together by merging the name and the "out('" before and the "');" after - didn't work either.

My code:

$(document).ready(function () {
      
   var content_01_onmouseout = $("#link_mainwindow_center_content_01").attr("onmouseout");
   
   var show_01 = function(){
      $("#link_mainwindow_center_content_01").attr({onmouseout:""});
   }
   var show_02 = function(){
      $("#link_mainwindow_center_content_01").attr({onmouseout:content_01_onmouseout});
   }
   
   $("#link_mainwindow_center_content_01").click(show_01);
   $("#link_mainwindow_center_content_02").click(show_02);
});


Sorry if I didn't see an obvious mistake - I'm really new to this stuff, and would be grateful if anybody could help me!