有关jqGrid插件的的问题

利用jqGrid如何替换下列代码
jsp中
function window.onload(){
buildTable(); //初始化表格

init();
drag = document.createElement("DIV");
drag.innerHTML      = "";
drag.style.textAlign="center";
drag.style.backgroundImage = "url(img/thead.gif)";
drag.style.fontWeight = "bold";
drag.style.position = "absolute";
drag.style.cursor   = "hand";
drag.style.border   = "1px solid black";
drag.style.display  = "none";
drag.style.zIndex   = "999";
drag.style.fontSize = "14px";
document.body.insertBefore(drag);

}
js中
function init(){
cur_row = null;
cur_col = null;
cur_cell = null;
Main_Tab = PowerTable;
read_def(Main_Tab);
Main_Tab.onmouseover = overIt;
Main_Tab.onmouseout = outIt;
Main_Tab.onclick = clickIt;
}
function buildTable(){
var tableHead = document.getElementById("TableHead");
var lis = document.getElementsByTagName("li");
var size = lis.length;
var n = 0;
var num = new Array();
for(var i=0;i<size;i++){
if(!lis[i].firstChild.checked)
continue;
var newTD = tableHead.insertCell(n);
newTD.setAttribute("noWrap","true");
newTD.innerHTML = lis[i].innerText;
num[n] = i;
n++;
}

//修改数组以便显示空格
for(var i = 0; i < contents.length; i++){
    var str = contents[i];
    if(str.length == 0){
        contents[i] = '&nbsp;';
    }
}

var table = document.getElementById("PowerTable");
for(var i=0;i<pSize;i++){
    var newTR = table.insertRow(i+1);
    newTR.setAttribute("bgColor", i%2==0?"#FFFFFF":"#BAC9E0"); //修改powertable的背景颜色修改奇偶列的样式
    for(var j=0;j<n;j++){
        var newTD = newTR.insertCell(j);
        newTD.setAttribute("noWrap","true");
        newTD.innerHTML = contents[num[j] + allSize*i];
    }
}

}

你要什么问?
function window.onload只有ie8-支持这样写,其他标准浏览器会报错改成这样

 window.onload=){
buildTable(); //初始化表格

init();
..............其他的代码