Strange "Element undefined" problem

Discussion in 'Javascript' started by Daniel Breitner, Jul 24, 2009.

  1. Hi experts,

    I get a strange Error "'Element' is undefined" in IE at
    http://bbold.de/exercises/cryptic_clue/index.php?exc=voltage
    It also does not work in FF; seems same problem, although FF shows no
    error at all. The funny (strange) thing is, that the *same* (!) code
    is *running* on
    http://demo2.wuwei-webservices.de/cryptic_clue/index.php?exc=voltage
    Here you can see, what this eLearning exercise should do actually.

    Since there it works fine, and on bbold.de not, where I simply wanted
    to install a copy, I am out of my abilites. Please help!

    Explanation to the line that IE complains about: (652 of page source)
    Element.addMethods(WuweiElementExtensions);

    WuweiElementExtensions is defined in the lines before, and then I
    simply going to attach the functions defined there to the Element
    object. This all is based on prototype framework. Why should Element
    here be undefined?? (And not at the other domain with the same code?)

    Thank you very much!!!
    Daniel

    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
     
    Daniel Breitner, Jul 24, 2009
    #1
    1. Advertising

  2. Matthias Reuter, Jul 24, 2009
    #2
    1. Advertising

  3. Matthias Reuter wrote:
    > [...] And it's generally a bad idea to include scripts inline.


    Nonsense. "Embedding scripts inline" avoids the overhead created by
    additional HTTP requests. Of course, it makes maintenance harder, so if
    that approach is followed it should be done through a server-side script.

    It is generally a bad idea to use Prototype.js, though.

    And the OP's markup is not Valid.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Jul 24, 2009
    #3
  4. Daniel Breitner meinte:

    [snip]

    > This all is based on prototype framework.


    Here is the problem.

    > Why should Element
    > here be undefined?? (And not at the other domain with the same code?)


    Not only the code - I assume the markup should be identical, too.

    > Thank you very much!!!


    You are welcome.

    BTW Firebug tells me:

    Element.addMethods is not a function
    http://bbold.de/exercises/cryptic_clue/index.php?exc=voltage
    Line 652

    Selector is undefined
    http://bbold.de/exercises/cryptic_clue/index.php?exc=voltage
    Line 4099


    Gregor


    --
    http://www.gregorkofler.com
    http://web.gregorkofler.com - vxJS, a JS lib in progress
     
    Gregor Kofler, Jul 24, 2009
    #4
  5. Daniel Breitner

    Jorge Guest

    On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > Matthias Reuter wrote:
    > > [...] And it's generally a bad idea to include scripts inline.

    >
    > Nonsense.  "Embedding scripts inline" avoids the overhead created by
    > additional HTTP requests. (...)


    .... and precludes the benefits of caching.

    --
    Jorge.
     
    Jorge, Jul 24, 2009
    #5
  6. On Fri, 24 Jul 2009 13:52:54 +0200, "Matthias Reuter"
    <> wrote:


    uh. thank u. i will check that out soon. if you are right (which i
    dont doubt), how could this happen... (question just to myself =)

    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
     
    Daniel Breitner, Jul 24, 2009
    #6
  7. On Fri, 24 Jul 2009 14:00:14 +0200, Thomas 'PointedEars' Lahn
    <> wrote:

    | Of course, it makes maintenance harder, so if
    |that approach is followed it should be done through a server-side script.
    |

    which is the case, btw. (Reason for this decision was to avoid
    cross-domain problems, iirc. Scripts reside on different domains but
    on same machine.)

    |It is generally a bad idea to use Prototype.js, though.

    Because... ?

    Everyone here agrees to PointedEars?



    *************

    Marty - it's perfect! You're just not thinking fourth dimensionally!
    [Emmett "Doc" Brown]

    If you wish to email me, please use newsreply at wuwei minus webservices dot de
     
    Daniel Breitner, Jul 24, 2009
    #7
  8. Daniel Breitner meinte:
    > On Fri, 24 Jul 2009 14:00:14 +0200, Thomas 'PointedEars' Lahn
    > <> wrote:


    > |It is generally a bad idea to use Prototype.js, though.
    >
    > Because... ?


    Search this group. Has been discussed more than once.

    > Everyone here agrees to PointedEars?


    The majority.

    > *************
    > [snip]


    Please use a correct sig separator.

    Gregor



    --
    http://www.gregorkofler.com
    http://web.gregorkofler.com - vxJS, a JS lib in progress
     
    Gregor Kofler, Jul 24, 2009
    #8
  9. Daniel Breitner wrote:
    > Thomas 'PointedEars' Lahn wrote:
    > | Of course, it makes maintenance harder, so if
    > |that approach is followed it should be done through a server-side script.


    The `|' character should be reserved for quotations from third-party sources
    (like documentation). Use `>' for in-thread quotations.

    > which is the case, btw. (Reason for this decision was to avoid
    > cross-domain problems, iirc. Scripts reside on different domains but
    > on same machine.)


    There are no cross-domain problems with script resources, though; you may
    include scripts from different domains (as you may include images from
    different domains), the SOP does not apply here as it is about documents.

    > |It is generally a bad idea to use Prototype.js, though.
    >
    > Because... ?


    See my sig (not so random this time).

    > Everyone here agrees to PointedEars?


    Probably not everyone, but many.

    > *************
    >
    > Marty - it's perfect! You're just not thinking fourth dimensionally!
    > [Emmett "Doc" Brown]


    I like that quote (one of my favorites), but I would like it better in a
    properly delimited signature (so that it would be recognized as such). Use
    dash-dash-space-newline instead of asterisks-newline, and keep your
    signature to 4 lines (not counting the delimiter).

    > If you wish to email me, please use newsreply at wuwei minus webservices dot de


    If you wish to participate in Usenet, learn about the rules that apply here.
    Home-improvement-like descriptions on how to reach you are not included.
    Use the Reply-To header, but make sure that the From header of your posting
    also specifies a mailbox (see RFCs 1036 and 2822).


    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$>
     
    Thomas 'PointedEars' Lahn, Jul 28, 2009
    #9
  10. In comp.lang.javascript message <>, Tue,
    28 Jul 2009 08:52:04, Thomas 'PointedEars' Lahn <>
    posted:
    >Daniel Breitner wrote:
    >> Thomas 'PointedEars' Lahn wrote:
    >> | Of course, it makes maintenance harder, so if
    >> |that approach is followed it should be done through a server-side script.

    >
    >The `|' character should be reserved for quotations from third-party sources
    >(like documentation). Use `>' for in-thread quotations.


    In which current RFC is that use of "|" to be found?


    >I like that quote (one of my favorites), but I would like it better in a
    >properly delimited signature (so that it would be recognized as such). Use
    >dash-dash-space-newline instead of asterisks-newline, and keep your
    >signature to 4 lines (not counting the delimiter).


    With which current RFC are your sigs compliant?


    >> If you wish to email me, please use newsreply at wuwei minus
    >>webservices dot de

    >
    >If you wish to participate in Usenet, learn about the rules that apply here.
    > Home-improvement-like descriptions on how to reach you are not included.
    >Use the Reply-To header, but make sure that the From header of your posting
    >also specifies a mailbox (see RFCs 1036 and 2822).



    And also, Daniel, learn to disregard chronic control-freakery; Usenet
    attracts certain of the psychologically disturbed.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
    Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
    Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
    Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
     
    Dr J R Stockton, Jul 28, 2009
    #10
  11. Jorge wrote:
    > On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    > wrote:
    >> Matthias Reuter wrote:
    >>> [...] And it's generally a bad idea to include scripts inline.

    >> Nonsense. "Embedding scripts inline" avoids the overhead created by
    >> additional HTTP requests. (...)

    >
    > ... and precludes the benefits of caching.
    >


    Just what I was thinking.

    Inline scripts are useful for dynamically generated server values that
    don't fit semantic meaning of the page.

    Garrett
    --
    comp.lang.javascript FAQ: http://jibbering.com/faq/
     
    Garrett Smith, Jul 29, 2009
    #11
  12. Garrett Smith wrote:
    > Jorge wrote:
    >> On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    >> wrote:
    >>> Matthias Reuter wrote:
    >>>> [...] And it's generally a bad idea to include scripts inline.
    >>> Nonsense. "Embedding scripts inline" avoids the overhead created by
    >>> additional HTTP requests. (...)

    >> ... and precludes the benefits of caching.


    Rubbish.

    > Just what I was thinking.


    Think again.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Jul 29, 2009
    #12
  13. Thomas 'PointedEars' Lahn wrote:
    > Garrett Smith wrote:
    >> Jorge wrote:
    >>> On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    >>> wrote:
    >>>> Matthias Reuter wrote:
    >>>>> [...] And it's generally a bad idea to include scripts inline.
    >>>> Nonsense. "Embedding scripts inline" avoids the overhead created by
    >>>> additional HTTP requests. (...)
    >>> ... and precludes the benefits of caching.

    >
    > Rubbish.
    >
    >> Just what I was thinking.

    >
    > Think again.


    Assuming a real application, not a static HTML file.


    --
    comp.lang.javascript FAQ: http://jibbering.com/faq/
     
    Garrett Smith, Jul 29, 2009
    #13
  14. Garrett Smith wrote:
    > Thomas 'PointedEars' Lahn wrote:
    >> Garrett Smith wrote:
    >>> Jorge wrote:
    >>>> On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    >>>> wrote:
    >>>>> Matthias Reuter wrote:
    >>>>>> [...] And it's generally a bad idea to include scripts inline.
    >>>>> Nonsense. "Embedding scripts inline" avoids the overhead created by
    >>>>> additional HTTP requests. (...)
    >>>> ... and precludes the benefits of caching.

    >> Rubbish.
    >>
    >>> Just what I was thinking.

    >> Think again.

    >
    > Assuming a real application, not a static HTML file.


    So what? It does _not_ "preclude the benefits of caching" in any case.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Jul 30, 2009
    #14
  15. Daniel Breitner

    Jorge Guest

    On Jul 30, 5:13 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > Garrett Smith wrote:
    > > Thomas 'PointedEars' Lahn wrote:
    > >> Garrett Smith wrote:
    > >>> Jorge wrote:
    > >>>> On Jul 24, 2:00 pm, Thomas 'PointedEars' Lahn <>
    > >>>> wrote:
    > >>>>> Matthias Reuter wrote:
    > >>>>>> [...] And it's generally a bad idea to include scripts inline.
    > >>>>> Nonsense.  "Embedding scripts inline" avoids the overhead createdby
    > >>>>> additional HTTP requests.  (...)
    > >>>> ... and precludes the benefits of caching.
    > >> Rubbish.

    >
    > >>> Just what I was thinking.
    > >> Think again.

    >
    > > Assuming a real application, not a static HTML file.

    >
    > So what?  It does _not_ "preclude the benefits of caching" in any case.


    Of course it does. If you embed the same <script> in 3 separate .htmls
    it gets downloaded 3 times. If, instead, you embed <script
    src="xxx.js"> in 3 separate .htmls, it gets downloaded just *once*.

    --
    Jorge.
     
    Jorge, Jul 30, 2009
    #15
  16. Daniel Breitner

    Evertjan. Guest

    Jorge wrote on 30 jul 2009 in comp.lang.javascript:

    > On Jul 30, 5:13 pm, Thomas 'PointedEars' Lahn <>
    >> So what?  It does _not_ "preclude the benefits of caching" in any case.

    >
    > Of course it does. If you embed the same <script> in 3 separate .htmls
    > it gets downloaded 3 times. If, instead, you embed <script
    > src="xxx.js"> in 3 separate .htmls, it gets downloaded just *once*.


    So what, if the page has an [yes, cachable but moreoften new] image of
    150kB and a js of 10kB?

    The overhead of seperate loading of that extra file could be far more time
    and cpu ticks consuming than the inclusion.

    <script type='text/javascript'>
    <!--#include file ="myJs.js"-->
    </script>

    vs:

    <script type='text/javascript' src='myJs.js'></script>

    I prefer the first one! [given that you have serverside includes]

    ========

    The caching of js files in the debugging fase is a pain in the neck.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 31, 2009
    #16
  17. Daniel Breitner

    Mike Duffy Guest

    "Evertjan." <> wrote in
    news:Xns9C595CCD73164eejj99@194.109.133.242:

    > The caching of js files in the debugging fase is a pain in the neck.


    For js debugging, I usually configure FF to clear its cache on exit without
    asking, and set up its home page to be the one I am currently debugging.

    If you need to test IE, you need to explicitly clear the cache, and I do it
    via a batch file that uses DEL, COPY, etc. commands in a CMD file to
    restore the cache to an "empty" state. It can also include a "START"
    command to run IE after.
     
    Mike Duffy, Jul 31, 2009
    #17
  18. Daniel Breitner

    Evertjan. Guest

    Mike Duffy wrote on 31 jul 2009 in comp.lang.javascript:

    > "Evertjan." <> wrote in
    > news:Xns9C595CCD73164eejj99@194.109.133.242:
    >
    >> The caching of js files in the debugging fase is a pain in the neck.

    >
    > For js debugging, I usually configure FF to clear its cache on exit
    > without asking, and set up its home page to be the one I am currently
    > debugging.
    >
    > If you need to test IE,


    Much to my distaste, it usually is.

    > you need to explicitly clear the cache, and I
    > do it via a batch file that uses DEL, COPY, etc. commands in a CMD
    > file to restore the cache to an "empty" state. It can also include a
    > "START" command to run IE after.


    Indeed, and all these extreme measures are not necessary by including the
    js in the primary html file.

    <script type='text/javascript'>
    <!--#include file ="myJs.js"-->
    </script>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jul 31, 2009
    #18
  19. Daniel Breitner

    Jorge Guest

    On Jul 31, 1:59 pm, Mike Duffy <> wrote:
    > "Evertjan." <> wrote innews:Xns9C595CCD73164eejj99@194.109.133.242:
    >
    > > The caching of js files in the debugging fase is a pain in the neck.

    >
    > For js debugging, I usually configure FF to clear its cache on exit without
    > asking, and set up its home page to be the one I am currently debugging.
    >
    > If you need to test IE, you need to explicitly clear the cache, and I do it
    > via a batch file that uses DEL, COPY, etc. commands in a CMD file to
    > restore the cache to an "empty" state. It can also include a "START"
    > command to run IE after.


    In my Mac, just typing command-option-e empties the caches... then
    command-r to reload.

    --
    Jorge.
     
    Jorge, Aug 1, 2009
    #19
  20. Daniel Breitner

    Mike Duffy Guest

    "Evertjan." <> wrote in
    news:Xns9C5A2DA98A4Ceejj99@194.109.133.242:

    > Mike Duffy wrote on 31 jul 2009 in comp.lang.javascript:


    .... extreme measures are not necessary by including the js

    >
    > <script type='text/javascript'>
    > <!--#include file ="myJs.js"-->
    > </script>
    >

    I asked my ISP for SSI. The response was basically that my question was not
    on the list of those for which they had perpared an answer.

    Their clients are mostly residential "amateurs" like myself who sign up for
    their broad band service (via the TV cable), and the web page hosting
    service they provide is primarily just so that they can legally advertise
    that they provide such a service. It is subcontracted to a subsidiary and
    consists of a limited (5 Meg) space with no possibility of talking to
    someone who knows more than how to reset your password.

    Once I sent them a $0.01 piece to pay for my share to double our disk
    quotas, but they did not find it amusing. They simply reminded me that the
    fine print in the contract says they can suspend this service without
    notice at any time when it becomes "in their best interests".
     
    Mike Duffy, Aug 1, 2009
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kload

    Strange Timing Problem

    Kload, Oct 23, 2003, in forum: VHDL
    Replies:
    2
    Views:
    609
    Kload
    Oct 23, 2003
  2. Akshaye
    Replies:
    1
    Views:
    762
    Hemant Gupta
    Feb 9, 2004
  3. Pedro Miguel Carvalho
    Replies:
    2
    Views:
    1,168
    Pedro Miguel Carvalho
    Oct 25, 2004
  4. Harvey Twyman
    Replies:
    8
    Views:
    583
    August Derleth
    Oct 25, 2003
  5. championsleeper
    Replies:
    0
    Views:
    587
    championsleeper
    Jan 26, 2005
Loading...

Share This Page