views:

220

answers:

1

Hi all,

I'm trying to implement this JavaScript code on blogspot (which parses XML code, some code works better than others)

 </head><body>
<div class="navbar section" id="navbar"><div class="widget Navbar" id="Navbar1"><script type="text/javascript">
    function setAttributeOnload(object, attribute, val) {
      if(window.addEventListener) {
        window.addEventListener("load",
          function(){ object[attribute] = val; }, false);
      } else {
        window.attachEvent('onload', function(){ object[attribute] = val; });
      }
    }
  </script>

That code results in rollover just fine with the following snip:

<img xsrc="/1.jpg" class="domroll /1flip.jpg" src="/1.jpg">

I'd like to modify the code so that it would replace a different image rather than the one it's currently under mouseover, but so far without luck. (perhaps by naming them and passing the names as variables)

Can anyone help?

thanks

+1  A: 

The snippet of JavaScript you have posted doesn't have anything to do with image rollovers, and doesn't produce the second snippet.

The first snippet allows you to change the attribute of an DOM node onLoad in a cross browser fashion. You might want to edit your question to put up the appropriate snippet.

ihumanable