# Stack overflow because of JS -why?

**URL:** <https://forum.kirupa.com/t/stack-overflow-because-of-js-why/206354>\
**Category:** Uncategorized\
**Created:** [November 7, 2006, 2:07pm UTC](https://forum.kirupa.com/t/stack-overflow-because-of-js-why/206354 "2006-11-07T14:07:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binji](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@Binji](https://forum.kirupa.com/u/Binji)\
**Post date:** [November 7, 2006, 2:07pm UTC](https://forum.kirupa.com/t/stack-overflow-because-of-js-why/206354/1 "2006-11-07T14:07:57Z")

</div>

I have a function which replaces one image with another originally meant for onmouseover function but i use also as a sort of PNG fix for IE. The idea is to have one pic loaded for FF and one for IE. The JS function looks like this:

```auto

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function rollOver(ime, pot, over){
    if ((version >= 5.5) && (version < 7) && (document.body.filters) && (!over)) 
    {
        document[ime].src='images/menu/'+ime+'.jpg';
        //alert(document[ime].src);
    }else if((version >= 5.5) && (version < 7) && (document.body.filters) && (over)){
        document[ime].src='images/menu/'+ime+'_over.jpg';
    }
    else{
        document[ime].src = pot;    
    }
}

```

so that the function loads different images depending on the type of browser and if the mouse is over the image. That works fine. But if i use it in IMG tag like this:

```auto

 onload="rollOver('disko', 'images/menu/disko.png', false)"

```

it returns stackOverflow when i open the document. Why is that and how could i make it work?

Thanks in advance!
