var tempStr=GetNewSelectStr(dataTable.value,"select"+rowIndex,true); makeSelectBox("select"+rowIndex,tempStr,value,obj); var nowOpenedSelectBox = ""; var mousePosition = ""; var userList=null; function selectThisValue(thisId,thisIndex,thisValue,thisString) { var objId = thisId; var nowIndex = thisIndex; var valueString = thisString; var sourceObj = $(objId); var nowSelectedValue = document.getElementById(nowIndex+thisId).innerHTML; hideOptionLayer(objId); if (sourceObj) sourceObj.value = nowSelectedValue; settingValue(objId,valueString); selectBoxFocus(objId); if (sourceObj.onchange) sourceObj.onchange(); }
function settingValue(thisId,thisString) { var objId = thisId; var valueString = thisString; var selectedArea = document.getElementById(objId+"selectBoxSelectedValue"); if (selectedArea) { if(navigator.appName.indexOf("Explorer") > -1){ selectedArea.innerText = valueString; } else{ selectedArea.textContent = valueString; } } }
var l=0; //显示下拉框中的值 function viewOptionLayer(thisId,Istask,flag) { var objId = thisId; var selectInfo=""; var optionHeight = 18; // 高 var optionMaxNum = 7; // var optionInnerLayerHeight = ""; var selectBoxWidth =130; var selectBoxHeight =17; l=userList.Rows.length; var optionLayer = document.getElementById(objId+"selectBoxs"); if(optionLayer.innerHTML=="") { if (l > optionMaxNum) optionInnerLayerHeight = "height:"+ (optionHeight * optionMaxNum) + "px"; selectInfo = "
"; if(Istask=="true") { selectInfo += "
"; selectInfo += "
"; selectInfo += "
"; selectInfo += "
"; selectInfo += "
"; selectInfo += "
"; } else { selectInfo += "
"; selectInfo += "
"; selectInfo += "
"; } selectInfo += "
"; selectInfo += "
"; selectInfo += " "; selectInfo += "
"; for (var i=0 ; i < l ; i++) { var nowValue = userList.Rows[i][userList.Columns[0].Name]; var nowText = userList.Rows[i][userList.Columns[0].Name]; if(Istask=="true") { selectInfo += "
function makeSelectBox(index,newSelect,value,obj) { newSelect=newSelect.replace(/(select0)/g,index); $(obj).html(newSelect); settingValue(index,value); } function GetNewSelectStr(table,index,IsTask){ userList=table; var downArrowSrc = "../images/sanjiao.gif"; //三角 var downArrowSrcWidth = 16; //宽 var selectBoxWidth =130; var selectBoxHeight =17;