IE not loading script?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony

    IE not loading script?

    I have a select with an onchange - it works find in Firefox, but in IE
    6 I get an error: Object Expected.

    I have simplified things drastically, and still get the error.

    The HTML:

    <select name="viewtrain " id="viewtrain" onchange="viewD etails(this);">
    <option value="1">Train 1</option>
    <option value="2">Train 2</option>
    <option value="3">Train 3</option>
    </select>

    and the javascript:

    function viewDetails(sel )
    {
    alert('hi');
    }

    For some reason, this fails. But if I replace viewDetails with an
    alert:
    <select name="viewtrain " id="viewtrain" onchange="alert (this);">
    everything works correctly.

    For some reason, it seems that IE isn't 'seeing' viewDetails.

    -
    OK I did a bit more checking before posting, and it seems that the js
    file isn't loading at all - but only in IE. I can't imagine why.
    here's the source:

    <script type="text/javascript" src="js/CalendarPopup.j s"></script>
    <script type="text/javascript" src="js/details.js"></script>
    <script type="text/javascript">
    ACTIVE_SECTION = 'Late Trains Details';
    </script>

    The stuff before and after works fine. Only details.js is not loading
    - and only in IE.

    I'm stumped on this one...
  • ellaiah.pusa@gmail.com

    #2
    Re: IE not loading script?

    stumps me too.


    On Apr 23, 4:33 pm, Tony <23.t...@gmail. comwrote:
    I have a select with an onchange - it works find in Firefox, but in IE
    6 I get an error: Object Expected.
    >
    I have simplified things drastically, and still get the error.
    >
    The HTML:
    >
    <select name="viewtrain " id="viewtrain" onchange="viewD etails(this);">
      <option value="1">Train 1</option>
      <option value="2">Train 2</option>
      <option value="3">Train 3</option>
    </select>
    >
    and the javascript:
    >
    function viewDetails(sel )
    {
      alert('hi');
    >
    }
    >
    For some reason, this fails. But if I replace viewDetails with an
    alert:
    <select name="viewtrain " id="viewtrain" onchange="alert (this);">
    everything works correctly.
    >
    For some reason, it seems that IE isn't 'seeing' viewDetails.
    >
    -
    OK I did a bit more checking before posting, and it seems that the js
    file isn't loading at all - but only in IE. I can't imagine why.
    here's the source:
    >
    <script type="text/javascript" src="js/CalendarPopup.j s"></script>
    <script type="text/javascript" src="js/details.js"></script>
    <script type="text/javascript">
    ACTIVE_SECTION = 'Late Trains Details';
    </script>
    >
    The stuff before and after works fine. Only details.js is not loading
    - and only in IE.
    >
    I'm stumped on this one...

    Comment

    • Andrew Bailey

      #3
      Re: IE not loading script?


      <ellaiah.pusa@g mail.comwrote in message
      news:4bfddd0c-f8d8-4080-b6fd-12ce80db52ad@59 g2000hsb.google groups.com...
      stumps me too.


      On Apr 23, 4:33 pm, Tony <23.t...@gmail. comwrote:
      I have a select with an onchange - it works find in Firefox, but in IE
      6 I get an error: Object Expected.
      >
      I have simplified things drastically, and still get the error.
      >
      The HTML:
      >
      <select name="viewtrain " id="viewtrain" onchange="viewD etails(this);">
      <option value="1">Train 1</option>
      <option value="2">Train 2</option>
      <option value="3">Train 3</option>
      </select>
      >
      and the javascript:
      >
      function viewDetails(sel )
      {
      alert('hi');
      >
      }
      >
      For some reason, this fails. But if I replace viewDetails with an
      alert:
      <select name="viewtrain " id="viewtrain" onchange="alert (this);">
      everything works correctly.
      >
      For some reason, it seems that IE isn't 'seeing' viewDetails.
      >
      -
      OK I did a bit more checking before posting, and it seems that the js
      file isn't loading at all - but only in IE. I can't imagine why.
      here's the source:
      >
      <script type="text/javascript" src="js/CalendarPopup.j s"></script>
      <script type="text/javascript" src="js/details.js"></script>
      <script type="text/javascript">
      ACTIVE_SECTION = 'Late Trains Details';
      </script>
      >
      The stuff before and after works fine. Only details.js is not loading
      - and only in IE.
      >
      I'm stumped on this one...
      Is it because you're calling details.js but the actual file is called
      Details.js with a capital?

      Andy

      Comment

      • Tony

        #4
        Re: IE not loading script?

        On Apr 23, 1:59 am, "Andrew Bailey" <a...@REMOVETOE MAILMEmanyplay. com>
        wrote:
        <ellaiah.p...@g mail.comwrote in message
        >
        news:4bfddd0c-f8d8-4080-b6fd-12ce80db52ad@59 g2000hsb.google groups.com...
        stumps me too.
        >
        On Apr 23, 4:33 pm, Tony <23.t...@gmail. comwrote:
        >
        >
        >
        I have a select with an onchange - it works find in Firefox, but in IE
        6 I get an error: Object Expected.
        >
        I have simplified things drastically, and still get the error.
        >
        The HTML:
        >
        <select name="viewtrain " id="viewtrain" onchange="viewD etails(this);">
        <option value="1">Train 1</option>
        <option value="2">Train 2</option>
        <option value="3">Train 3</option>
        </select>
        >
        and the javascript:
        >
        function viewDetails(sel )
        {
        alert('hi');
        >
        }
        >
        For some reason, this fails. But if I replace viewDetails with an
        alert:
        <select name="viewtrain " id="viewtrain" onchange="alert (this);">
        everything works correctly.
        >
        For some reason, it seems that IE isn't 'seeing' viewDetails.
        >
        -
        OK I did a bit more checking before posting, and it seems that the js
        file isn't loading at all - but only in IE. I can't imagine why.
        here's the source:
        >
        <script type="text/javascript" src="js/CalendarPopup.j s"></script>
        <script type="text/javascript" src="js/details.js"></script>
        <script type="text/javascript">
        ACTIVE_SECTION = 'Late Trains Details';
        </script>
        >
        The stuff before and after works fine. Only details.js is not loading
        - and only in IE.
        >
        I'm stumped on this one...
        >
        Is it because you're calling details.js but the actual file is called
        Details.js with a capital?
        >
        Andy
        That wasn't the problem - I had rechecked the path & capitalization.

        Finally figured it out. There was a variable named 'class' in the
        file. Apparently, IE doesn't like that. Changing it to 'classname'
        fixed the problem.

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: IE not loading script?

          Tony wrote:
          [...] "Andrew Bailey" [...] wrote:
          ><ellaiah.p...@ gmail.comwrote [...]:
          >On Apr 23, 4:33 pm, Tony <23.t...@gmail. comwrote:
          >>[...]
          >><script type="text/javascript" src="js/CalendarPopup.j s"></script>
          >><script type="text/javascript" src="js/details.js"></script>
          >><script type="text/javascript">
          >>ACTIVE_SECTIO N = 'Late Trains Details';
          >></script>
          >>The stuff before and after works fine. Only details.js is not loading
          >>- and only in IE.
          >>I'm stumped on this one...
          >Is it because you're calling details.js but the actual file is called
          >Details.js with a capital?
          >[...]
          >
          That wasn't the problem - I had rechecked the path & capitalization.
          >
          Finally figured it out. There was a variable named 'class' in the
          file. Apparently, IE doesn't like that. Changing it to 'classname'
          fixed the problem.
          No ECMAScript-compliant engine likes it if you use reserved words for
          identifiers.


          PointedEars
          --
          Prototype.js was written by people who don't know javascript for people
          who don't know javascript. People who don't know javascript are not
          the best source of advice on designing systems that use javascript.
          -- Richard Cornford, cljs, <f806at$ail$1$8 300dec7@news.de mon.co.uk>

          Comment

          • Bart Van der Donck

            #6
            Re: IE not loading script?

            Tony wrote:
            That wasn't the problem - I had rechecked the path & capitalization.
            >
            Finally figured it out. There was a variable named 'class' in the
            file. Apparently, IE doesn't like that. Changing it to 'classname'
            fixed the problem.
            Then you are lucky this time. But 'classname' is also reserved; best
            to rename it again.

            --
            Bart

            Comment

            • Evertjan.

              #7
              Re: IE not loading script?

              Bart Van der Donck wrote on 24 apr 2008 in comp.lang.javas cript:
              Tony wrote:
              >
              >That wasn't the problem - I had rechecked the path & capitalization.
              >>
              >Finally figured it out. There was a variable named 'class' in the
              >file. Apparently, IE doesn't like that. Changing it to 'classname'
              >fixed the problem.
              >
              Then you are lucky this time. But 'classname' is also reserved; best
              to rename it again.
              'className' is, not 'classname'.



              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)

              Comment

              • Bart Van der Donck

                #8
                Re: IE not loading script?

                Evertjan. wrote:
                Bart Van der Donck wrote on 24 apr 2008 in comp.lang.javas cript:
                >Note that 'className' was identical
                >to 'classname' until Internet Explorer 4 and Netscape Navigator 6:
                >http://safari.oreilly.com/1565923928/JSCRIPT-PT-1(last paragraph)
                >
                Not my oracle!
                Mine neither :-) I doubt if 'className' would have been supported
                anyhow in those browsers.

                --
                Bart

                Comment

                • Thomas 'PointedEars' Lahn

                  #9
                  Re: IE not loading script?

                  Bart Van der Donck wrote:
                  Tony wrote:
                  >That wasn't the problem - I had rechecked the path & capitalization.
                  >>
                  >Finally figured it out. There was a variable named 'class' in the
                  >file. Apparently, IE doesn't like that. Changing it to 'classname'
                  >fixed the problem.
                  >
                  Then you are lucky this time. But 'classname' is also reserved;
                  No, it is not, and neither is `className'.
                  best to rename it again.
                  That depends on where that identifier is used. As a *variable name* like
                  here, it is completely harmless.


                  PointedEars
                  --
                  realism: HTML 4.01 Strict
                  evangelism: XHTML 1.0 Strict
                  madness: XHTML 1.1 as application/xhtml+xml
                  -- Bjoern Hoehrmann

                  Comment

                  • Bart Van der Donck

                    #10
                    Re: IE not loading script?

                    Thomas 'PointedEars' Lahn wrote:
                    Bart Van der Donck wrote:
                    >
                    >But 'classname' is also reserved [...]
                    >
                    No, it is not, and neither is `className'.
                    I was not referring to the official "Reserved Words"; I used the word
                    'reserved' outside of that context.
                    >best to rename it again.
                    >
                    That depends on where that identifier is used.  
                    Correct, but as you undoubtedly know better than me, a variable name
                    is only a property of the window-object. You will want to avoid
                    confusion and not use things like window.classNam e. A good deal of
                    programmers will interpret such code as an attempt to influence the
                    class of the window (if such a thing would exist). Of course your
                    statement is theoretically true; but it leads to bad habits and
                    dangerous consequences in practice. Software is not an exact science.
                    As a *variable name* like here, it is completely harmless.
                    Is it "completely harmless" to create confusion like that ? No, it
                    isn't. Better keep things clear when writing code; rule number one as
                    far as I'm concerned.

                    --
                    Bart

                    Comment

                    • Evertjan.

                      #11
                      Re: IE not loading script?

                      Bart Van der Donck wrote on 27 apr 2008 in comp.lang.javas cript:
                      Thomas 'PointedEars' Lahn wrote:
                      >
                      >Bart Van der Donck wrote:
                      >>
                      >>But 'classname' is also reserved [...]
                      >>
                      >No, it is not, and neither is `className'.
                      >
                      I was not referring to the official "Reserved Words"; I used the word
                      'reserved' outside of that context.
                      >
                      >>best to rename it again.
                      >>
                      >That depends on where that identifier is used.  
                      >
                      Correct, but as you undoubtedly know better than me, a variable name
                      is only a property of the window-object. You will want to avoid
                      confusion and not use things like window.classNam e. A good deal of
                      programmers will interpret such code as an attempt to influence the
                      class of the window (if such a thing would exist). Of course your
                      statement is theoretically true; but it leads to bad habits and
                      dangerous consequences in practice. Software is not an exact science.
                      >
                      >As a *variable name* like here, it is completely harmless.
                      >
                      Is it "completely harmless" to create confusion like that ? No, it
                      isn't.
                      Indeed it isn't.
                      Test these before and afther the mouseovers,
                      It will confuse anyone but Thomas:

                      <style type='text/css'>
                      ..x {background-color:blue;}
                      </style>

                      <span
                      id='d1'
                      classname='z'
                      onmouseover='th is.className="x "'>
                      Hi
                      </span>

                      <button onclick='alert( document.getEle mentById("d1"). classname)'>
                      click</button>
                      <p>
                      <span
                      id='d2'
                      className='z'
                      onmouseover='th is.className="x "'>
                      Hi
                      </span>

                      <button onclick='alert( document.getEle mentById("d2"). className)'>
                      click</button>



                      Better keep things clear when writing code; rule number one as
                      far as I'm concerned.


                      --
                      Evertjan.
                      The Netherlands.
                      (Please change the x'es to dots in my emailaddress)

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: IE not loading script?

                        Bart Van der Donck wrote:
                        Thomas 'PointedEars' Lahn wrote:
                        >Bart Van der Donck wrote:
                        >>But 'classname' is also reserved [...]
                        >No, it is not, and neither is `className'.
                        >
                        I was not referring to the official "Reserved Words"; I used the word
                        'reserved' outside of that context.
                        I just wanted to make things clear to the dedicated reader.
                        >>best to rename it again.
                        >That depends on where that identifier is used.
                        >
                        Correct, but as you undoubtedly know better than me, a variable name
                        is only a property of the window-object.
                        Yes, I do, for your statement is imprecise at best. Variables become
                        properties of the *Variable Object of the execution context* they have been
                        declared in, with the DontDelete attribute. That object is the Global
                        Object only for the global execution context. The Global Object only MAY
                        have a host-defined property named `window' that refers to the Global Object
                        again, and even that reference target cannot be taken for granted.
                        You will want to avoid confusion and not use things like window.classNam e.
                        A good deal of programmers will interpret such code as an attempt
                        to influence the class of the window (if such a thing would exist).
                        ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
                        There, don't you see? I don't have time to care about clueless programmers
                        (JFTR, that does not mean "newbies" which is quite different). A Window
                        object is not an HTML DOM object and therefore is unlikely to have a
                        *host-defined property* named `className'. I would avoid adding a property
                        to a host object, but I don't see a problem of using `classname' or
                        `className' as a variable name, provided the semantics of the identifier fit
                        the context in which it is used.
                        Of course your statement is theoretically true; but it leads to bad habits and
                        dangerous consequences in practice. Software is not an exact science.
                        To acquire the result of misconceptions about code as a bad habit is the
                        choice of its reader of that code to make, and not my task to prevent or
                        avoid. For I would consider it a requirement for survival in this
                        informational age to be a able to weigh perceived information carefully
                        before it is being accepted as the truth and become applied knowledge later.
                        >As a *variable name* like here, it is completely harmless.
                        >
                        Is it "completely harmless" to create confusion like that ? No, it
                        isn't. Better keep things clear when writing code; rule number one as
                        far as I'm concerned.
                        Any piece of source code can cause all kinds of confusion among the
                        uninitiated. If I were to consider that every time I write a line of code,
                        I would never ever finish any program because people are so very different,
                        and so numerous are the different ways in which they can err.


                        PointedEars
                        --
                        Use any version of Microsoft Frontpage to create your site.
                        (This won't prevent people from viewing your source, but no one
                        will want to steal it.)
                        -- from <http://www.vortex-webdesign.com/help/hidesource.htm>

                        Comment

                        • abcdefghij444@gmail.com

                          #13
                          Re: IE not loading script?

                          Thomas 'PointedEars' Lahn wrote:
                          Bart Van der Donck wrote:
                          >
                          >You will want to avoid confusion and not use things like window.classNam e..
                          >A good deal of programmers will interpret such code as an attempt
                          >to influence the class of the window (if such a thing would exist).
                          >
                          >                                       ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^
                          There, don't you see?  I don't have time to care about clueless programmers
                          (JFTR, that does not mean "newbies" which is quite different).
                          What's that, a clueless programmer ? Someone who doesn't know that
                          'className' is not a host-defined property of the window-object ? Such
                          a thing could happen to me too. You can't expect from a programmer to
                          know all host objects and their properties by head.

                          Nothing wrong with not knowing something, as long as you know the
                          places where to look it up.

                          It *IS* the duty of the programmer to write clear code as to avoid
                          (possible) ambiguity wherever he can. Do your code readers, your
                          successor and yourself-in-the-future a favour :)

                          I'm almost sure you will change your view sooner or later.

                          --
                          Bart

                          Comment

                          • Tony

                            #14
                            Re: IE not loading script?

                            On Apr 24, 12:58 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
                            wrote:
                            Tony wrote:
                            [...] "Andrew Bailey" [...] wrote:
                            <ellaiah.p...@g mail.comwrote [...]:
                            On Apr 23, 4:33 pm, Tony <23.t...@gmail. comwrote:
                            >[...]
                            ><script type="text/javascript" src="js/CalendarPopup.j s"></script>
                            ><script type="text/javascript" src="js/details.js"></script>
                            ><script type="text/javascript">
                            >ACTIVE_SECTI ON = 'Late Trains Details';
                            ></script>
                            >The stuff before and after works fine. Only details.js is not loading
                            >- and only in IE.
                            >I'm stumped on this one...
                            Is it because you're calling details.js but the actual file is called
                            Details.js with a capital?
                            [...]
                            >
                            That wasn't the problem - I had rechecked the path & capitalization.
                            >
                            Finally figured it out. There was a variable named 'class' in the
                            file. Apparently, IE doesn't like that. Changing it to 'classname'
                            fixed the problem.
                            >
                            No ECMAScript-compliant engine likes it if you use reserved words for
                            identifiers.
                            >
                            PointedEars
                            Interesting that IE had a problem with 'class', but FireFox didn't.
                            Does it follow that FireFox is not ECMAScript-compliant?

                            Comment

                            • Thomas 'PointedEars' Lahn

                              #15
                              Re: IE not loading script?

                              Tony wrote:
                              [...] Thomas 'PointedEars' Lahn [...] wrote:
                              >Tony wrote:
                              >>Finally figured it out. There was a variable named 'class' in the
                              >>file. Apparently, IE doesn't like that. Changing it to 'classname'
                              >>fixed the problem.
                              >No ECMAScript-compliant engine likes it if you use reserved words for
                              >identifiers.
                              >
                              Interesting that IE had a problem with 'class', but FireFox didn't.
                              Does it follow that FireFox is not ECMAScript-compliant?
                              No, Firefox (i.e. JavaScript 1.5+) issues only a warning:

                              | (!) class is a reserved identifier
                              |
                              | var class = "foo";


                              PointedEars
                              --
                              var bugRiddenCrashP ronePieceOfJunk = (
                              navigator.userA gent.indexOf('M SIE 5') != -1
                              && navigator.userA gent.indexOf('M ac') != -1
                              ) // Plone, register_functi on.js:16

                              Comment

                              Working...