SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: DHTML Misery

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DHTML Misery

    Hi,
    I'm primarily a php dev but I'm writing a pretty simple system for a client of ours to allow them to put details of meetings on their site. Given that it's a pretty straight forward project I decided to dip my toes into the world of DHTML and the DOM to give the thing some extra functionality.

    However I'm having some serious trouble getting it to behave in IE(surprise, surprise!)

    Here's how it is at the moment:

    http://212.69.211.103/nwwrac/admin/p...ddMeeting.php#

    When you click on the "add another category" link it adds an extra category with 1 field for adding papers and a button for selecting the papers from a popup. When you update the field for papers it adds an extra 'papers' field in that category if there aren't any more available.

    The problem is that the event handlers aren't working for any of the dynamically generated HTML in IE.

    I've looked at the generated source(using javascript:'<xmp>'%20+%20window.document.body.outerHTML+%20'</xmp>') and all the new handlers are there but for some weird reason they're just not firing.

    Of course everything works fine in FF...

    Anyone any ideas?

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2005
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    less trouble with DOM if you use CSS to format the form, less elements to generate too.

    But the IE problem maybe because of missing <tbody> element in your table, wrap each new row in <tbody>

  3. #3
    SitePoint Member
    Join Date
    May 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did a lot of digging and sussed it out. Basically you have to use:

    object.event = function;

    This means you're passing the function by reference so to get whatever object calls the function from within that function you'd use:

    Code:
    function handleClick(){
    var id = this.id;
    alert(id);
    }
    It's a little bizarre to say the least! If anyone can explain what the heck is going on there I'd be intrigued...

    And yeah i'll probably switch it over to css now that I'm happy that I can get it to work.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •