2011-03-17 81 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

回答