I would like to change a DOM Object with a turbogears ajax call.
At the moment the ajax call returns a string with the html of the node
that should be replaced. How can I swap the existing DOM Object with
the new one I got from the ajax callback?

InnerHTML replaces the inner part of the element, but I want to
replace the whole thing. OuterHtml seems to what I need but it does
not work in Firefox. swapDOM takes two DOM-Objects, but I've only got
a string for the replacement. How can I convert a string to a DOM
object?

Pseudo example:

<html>
<table>
<tr><td id="thisisatd" colspan="2">A text</td></tr>
</table>
</html>

>From the Ajax call I get the string back "<td id="thisisatd"
colspan="3">A new text</td></tr>".
How can I replace the td with this new string?

My current function to do this looks like this:

    var doReplace = function (req) {
        for (var e in req.changes) {
            var element = document.getElementById(e)
            if (element) {
                element.outerHTML = req.changes[e];  // <- Does not work in 
Firefox
           }
            else {
                alert("element not found:" + e);
            }
        }
    }

--~--~---------~--~----~------------~-------~--~----~
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