data.js 所有操作js代碼 var xmlHttp; var xmlContent; //ajax請(qǐng)求后返回保存的數(shù)據(jù) var key = ""; var id = ""; //---------------------樣式設(shè)置------------------// var divid = "selectData" //說明第4步 var txtValueID = "selectValue"; //說時(shí)第2步 var fieldNames = new Array(3); //單擊某行取值是,每列值前添加一個(gè)該值列名 var isShowFieldNames = true; //取值時(shí),是否要顯示列名 true為顯示,false不顯示 fieldNames[0]="編號(hào):"; fieldNames[1]="用戶名:"; fieldNames[2]="密碼:"; var pageSize = 10; //每頁顯示行數(shù) var onmouseoverBG = "#DDFFEC"; //鼠標(biāo)移上去該行的背景顏色 var onmouseoutBG = "#ffffff"; //鼠標(biāo)離開后該行的背景顏色 //表頭列名根據(jù)需要修改 var tableHead = ""; tableHead += "
編號(hào)
"; tableHead += "
用戶名
"; tableHead += "
密碼
"; tableHead += ""; //數(shù)據(jù)綁定字段名,修改DATAFLD里的的字段名 var dataFiled = "
"; dataFiled += "
"; dataFiled += "
"; var RequestFile = "getXml1.aspx"; //請(qǐng)求頁面 //-------------------外部調(diào)用--------------------------// //顯示選擇 //productID是下拉框ID,請(qǐng)根據(jù)需要修改 function show() { $(divid).style.display = '' $(divid).style.position="absolute" $(divid).style.backgroundColor="#FFFFFF" key = ""; id = productID.options[productID.selectedIndex].value; RequestXML(); } //分類改變時(shí)隱藏 function changeID() { hide(); } //---------------------內(nèi)部方法,一般不用修改---------------------------// //選擇某行的值,顯示到文本框 function getCurrentRowData(tr) { var tds = tr.getElementsByTagName("td") //得到所有列 var result=""; for(var i = 0; i < tds.length; i++) { if(isShowFieldNames){result += fieldNames[i]}; if(i != tds.length -1 )//是否是最后一列 { result += tr.getElementsByTagName("div")[i].firstChild.nodeValue + ","; //得到第i列的值 + "," } else { result += tr.getElementsByTagName("div")[i].firstChild.nodeValue; //得到第i列的值 } } $(txtValueID).value = result; hide(); } //顯示內(nèi)容 function ShowData() { var data = $(divid); var content = ""; content += ""; content += "