[jQuery] Need to modify function to change buttons location

[jQuery] Need to modify function to change buttons location


Need help to reposition buttons to a particular DIV within a pageBreak
and Table.
Right now, it's simply placing the buttons under the table.
Can anyone help me figure this out?
Erik
function setButtons(pageBreak){
        for (var i = 0; i < pageBreak.pages.length; i++) {
            for (var j = 0; j < pageBreak.pages[i].childNodes.length; j++) {
                if (pageBreak.pages[i].childNodes[j].nodeName == "TABLE") {
                    var table = pageBreak.pages[i].childNodes[j];
                    var rows = table.getElementsByTagName('tr');
                    if (rows.length<1){
                        continue;
                    }
                    var lastRow = rows[rows.length-1];
                    var myCells = lastRow.getElementsByTagName('td');
                    var myCell = myCells[0];
                    if (!lastRowButton(table) || i != (pageBreak.pageLength - 1)) {
                        var myRow = table.insertRow(-1);
                        var myCell = myRow.insertCell(-1);
                        var myCell2 = myRow.insertCell(-1);
                    }
                    if (i != 0) {
                        var backButton = document.createElement("div");
                        backButton.className = "backButton";
                        backButton.onclick = function(){
                            goBackPage(pageBreak);
                        };
                        myCell.appendChild(backButton);
                    }
                    if (i != pageBreak.pageLength - 1) {
                        var nextButton = document.createElement("div");
                        nextButton.className = "nextButton";
                        nextButton.onclick = function(){
                            goNextPage(pageBreak);
                        };
                        myCell2.appendChild(nextButton);
                    }
                } // if element is table
            } // look for all elements in page
        } // look for all pages
    } // end of function