Re: onclick and DOM in parent window problem

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

    Re: onclick and DOM in parent window problem

    Martin Honnen ha scritto:
    Use properties, not setAttribute:
    myTd7.className = "adminfield ";
    Sorry, which is the difference?
    myTd7a.setAttri bute("onclick", "javascript:del eteRow(this)");
    >
    myTd7a.onclick = function () { deleteRow(this) ; };
    Done, but however i have the same problem...nothi ng is done and no
    error appear...
    I have also an "alert" into the function but is not executed. :-/
  • Thomas 'PointedEars' Lahn

    #2
    Re: onclick and DOM in parent window problem

    Flyzone wrote:
    Martin Honnen ha scritto:
    >Use properties, not setAttribute:
    > myTd7.className = "adminfield ";
    >
    Sorry, which is the difference?
    The difference is, since Element::setAtt ribute() is known to suffer from
    a number of buggy implementations , you should use the attribute property
    instead of E::setAttribute () where there is one.
    >>myTd7a.setAtt ribute("onclick ","javascript:d eleteRow(this)" );
    > myTd7a.onclick = function () { deleteRow(this) ; };
    >
    Done, but however i have the same problem...nothi ng is done and no
    error appear...
    I have also an "alert" into the function but is not executed. :-/
    Then the error is likely to be elsewhere, and you should debug your code:





    <FAQENTRY>
    As mentioned earlier, the FAQ Notes entry "Don't work" should refer to
    FAQ 4.43.

    FAQ 4.43 should refer to to FAQ 3.2 since debuggers help to show
    non-obvious errors.

    FAQ 3.2 should be structured better. It desperately needs one or more
    unordered lists and to contain at least one subsection titled "Debuggers" ,
    which should at least include references to Venkman, the debugger in
    Firebug, and the Microsoft Script Debugger.

    Opera 9.x and Apple Safari 3.x provide pretty neat developer tools as
    well:

    * http://dev.opera.com/tools/

    * http://developer.apple.com/internet/....html#anchor14
    (The information there appears to be slightly out of date; you need
    to put that key into WebKitPreferenc es.plist instead. YMMV.)
    </FAQENTRY>

    That said, you may have better luck with the standards-compliant approach,
    and the proprietary one only as a fallback:

    function isMethod(o, p)
    {
    var t;
    return o && /\b(function|obj ect|unknown)\b/i.test(typeof o[p]) && o[p];
    }

    var o = myTd7a,
    f = function() { deleteRow(this) ; };

    if (isMethod(o, "addEventListen er"))
    {
    o.addEventListe ner("click", f, false);
    }
    else if (typeof o.onclick != "undefined" )
    {
    o.onclick = f;
    }


    HTH

    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

    • Flyzone

      #3
      Re: onclick and DOM in parent window problem

      On 14 Apr, 11:52, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
      wrote:
      function isMethod(o, p)
      I solved the problem.
      In the source HTML i neede to add also the <tbodytag, that FF add by
      itself using the dom, but IE need to show the new table.

      Comment

      Working...