2011-03-17 179 views
0

有人可以将这个普通的javascript函数转换为使用jquery函数吗?谢谢!将此javascript函数转换成jquery

move_object = function (from, to) { 
    var i, // local variable 
    childnodes_length; // number of child nodes 
    // test if "from" cell is equal to "to" cell then do nothing 
    if (from === to) { 
     return; 
    } 
    // define childnodes length before loop (not 
    // in loop because NodeList objects in the DOM are live) 
    childnodes_length = from.childNodes.length; 
    // loop through all child nodes 
    for (i = 0; i < childnodes_length; i++) { 
     // '0', not 'i' because NodeList objects in the DOM are live 
     to.appendChild(from.childNodes[0]); 
    } 
}; 
+3

肯定。您希望我们做的其他任何事情? – svens 2011-03-17 19:53:07

+0

您可以发布您的JQuery代码版本,并让我们知道您遇到的问题吗? – WorldIsRound 2011-03-17 19:54:26

+0

这个函数做什么?你有没有试过jQuery?试试这些http://api.jquery.com/children/ – zod 2011-03-17 19:54:27

回答