Javascript-created elements won't trigger in IE

Discussion in 'Javascript' started by joeakabloo@gmailabc.com, Apr 24, 2006.

  1. Guest

    OK I made a better example for this issue:

    http://sandbox.lesshype.com/home.php

    2 buttons, one created prior to sending the page, and one created on
    the fly by javascript DOM method. Both have an alert onclick action
    applied.

    The javascript one will not trigger in IE under and circumstances. Any
    thoughts?

    Thanks in advance
    Joe
    , Apr 24, 2006
    #1
    1. Advertising

  2. On 24/04/2006 13:20, wrote:

    [snip]

    > http://sandbox.lesshype.com/home.php


    [snip]

    > The javascript one will not trigger in IE under and circumstances. Any
    > thoughts?


    If you had looked through the archives of this group, you would have
    understood why.

    Do not use the setAttribute method to add event listeners. Use the
    intrinsic event properties, instead. In fact, avoiding the setAttribute
    method is a good idea, in general, as IE doesn't implement it well.


    Notes about that document:

    - Serving XHTML as HTML is pointless at best. Serving XHTML
    Transitional really /is/ a waste of time; not even new HTML
    should be written to the Transitional DTD. If you must (which
    is unlikely to be the case), don't include the XML prolog as
    it will throw IE into Quirks mode.
    - The Content-Type meta element is redundant. Your server is
    sending a Content-Type header, and that will take precedence.
    - Comment declarations in script and style element content has
    been unnecessary in HTML for years. It is catastrophic in
    XHTML: the comment will be taken literally and the content
    will be ignored.
    - If I read your intentions right, you want to use the
    XMLHttpRequest object to load both content and navigation. If
    this is for the Web, that is a /terrible/ idea.
    If you want to load content dynamically, use a server-side
    language. You have PHP, so put it to use. Relying on scripting
    to provide content is bad enough, but a feature like the
    XMLHttpRequest object is so much worse.

    Mike

    --
    Michael Winter
    Prefix subject with [News] before replying by e-mail.
    Michael Winter, Apr 24, 2006
    #2
    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. Replies:
    0
    Views:
    4,855
  2. =?Utf-8?B?QW5hbmQ=?=

    Postback won't trigger

    =?Utf-8?B?QW5hbmQ=?=, Mar 7, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    528
    Juan T. Llibre
    Mar 8, 2005
  3. Vikram
    Replies:
    6
    Views:
    639
    Vikram
    Apr 7, 2005
  4. Nicholas Couch

    IE6 won't hide dynamically created span elements

    Nicholas Couch, Sep 17, 2004, in forum: Javascript
    Replies:
    20
    Views:
    218
    Thomas 'PointedEars' Lahn
    Sep 26, 2004
  5. Michael

    Arrow keys won't trigger keypress

    Michael, Aug 6, 2005, in forum: Javascript
    Replies:
    2
    Views:
    93
Loading...

Share This Page