I think you can do this in a number of ways. I've mentioned some of it below:
1. Inline event handling for onmouseover and onmouseout like the following code:
[CODE]<img id="img1" src="arrow4.png" alt="dalej" onmouseover="this.src='arrow1.png';" onmouseout="this.src='arrow4.png';" />[CODE]
2. Replace your current img tag with the following one. It looks similar to your but there is one key difference in the way the JS function being called. Insert the JS function below in place of the current functions.
Code:
<img id="img1" src="arrow4.png" alt="dalej" onmouseover="changeOverImage(this);" onmouseout="changeOutImage(ICODE]this[/ICODE]);" />
function changeOverImage(obj){
obj.src = 'arrow1.png';
}
function changeOutImage(obj){
obj.src = 'arrow4.png';
}
3.
Use the following img tag. There is no event related attributes in the tag
Code:
<img id="img1" src="arrow4.png" alt="dalej"/>
After that insert the below mentioned script element after the img tag mentioned above. This is very important you need to put the below script element after the above mentioned img tag otherwise it will not work as expected.
Code:
<script type="text/javascript">
(function() {
if (document.getElementById('img1')) {
document.getElementById('img1').onmouseover = function() {
this.src = '2.gif';
};
document.getElementById('img1').onmouseout = function() {
this.src = '1.gif';
};
}
})();
</script>
Hope this helps.
Bookmarks