If I understand you correctly, this would do the trick; not a part
of MochiKit but fairly simple regardless. If you update html on an
element and the html you're updating with contains script tags, after
you set innerHTML or whatever method you choose,
execute_javascript(element). I've used it in IE6/7, FF1/2, Safari 1/2,
Mac FF. Not on Opera but I assume it works fine (as someone told me it
worked in the Wii Opera browser).

  -Kevin

  function execute_javascript (element) {

    var element = MochiKit.DOM.getElement(element);

    if (element) {

      var st = element.getElementsByTagName("SCRIPT");
      var string_to_execute;

      for (var i=0;i<st.length; i++) {

        string_to_execute = st[i].innerHTML;

        try {

          eval(string_to_execute.split("<!--").join("").split("--
>").join(""));

        } catch(e) {

          MochiKit.Logging.log(e);

        } // end try

      } // end for

    } // end if

  }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to