# JS in IE6 + IE7 fails 25% of the time

**URL:** <https://forum.kirupa.com/t/js-in-ie6-ie7-fails-25-of-the-time/295809>\
**Category:** web dev\
**Created:** [September 4, 2009, 5:19pm UTC](https://forum.kirupa.com/t/js-in-ie6-ie7-fails-25-of-the-time/295809 "2009-09-04T17:19:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [September 4, 2009, 5:19pm UTC](https://forum.kirupa.com/t/js-in-ie6-ie7-fails-25-of-the-time/295809/1 "2009-09-04T17:19:13Z")

</div>

Hi folks,

I’ve got my site working in FF, Safari, and IE8, but I need some help getting it to work in IE7. I’m using the Prototype library, by the way. I suspect it has nothing to do with Prototype and more to do with how IE7 and 6 execute JS unpredictably.

![](http://forum.kirupa.com/uploads/kirupa/5772/52c6d7fcc4493394.png)

To see the error, click the button. It will only happen about 25% of page loads, so reload the page if you don’t see it.

```php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <script src="scripts/lib/prototype.js" type="text/javascript"></script>
        <script src="scripts/src/scriptaculous.js" type="text/javascript"></script>
        <script type="text/javascript">
            //<![CDATA[
            var MYAPP = {
                Class1: null,
                class1: null
            }
            
            MYAPP.Class1 = Class.create({
                initialize: function() {
                    this.myValue = 'my value';
                },
                speak: function() {
                    alert(this.myValue);
                }
            });
            
            Event.observe(window, 'load', function() {
                MYAPP.class1 = new MYAPP.Class1();
            });
            //]]>
        </script>
    </head>
    <body>
        <button onclick="MYAPP.class1.speak()" />make class1 speak</button>
    </body>
</html>

```
