var comboAttribute; function $(id){ return document.getElementById(id); } function initType(){ var attributeObj = null; // if($("h_attrid").value.trim() == ""){ // $("h_attrid").value = comboAttribute.getComboValue(); // } var url = "../FeeCodes/AttributeAdapter.aspx?handle=attrinfo&attrid="+$("h_attrid").value+"&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var attributeVal = loader.xmlDoc.responseText;//alert(opInfo); var attributeObj = eval('(' + attributeVal + ')'); if(attributeObj.attr.length > 0){ var selType = $("sel_type"); selType.options.length = 0; selType.add(new Option(attributeObj.attr[0].type,attributeObj.attr[0].type)); $("h_attrid").value = attributeObj.attr[0].id; $("h_type").value = attributeObj.attr[0].type; $("txt_description").value = attributeObj.attr[0].name; switch(attributeObj.attr[0].type){ case "bool": var tempTrueVal = $("h_attrval").value.trim() == "true"?"checked":""; var tempFalseVal = $("h_attrval").value.trim() == "true"?"":"checked"; $("txt_attrval").innerHTML = "
" + "
" break; case "int": $("txt_attrval").innerHTML = ""; break; case "string": $("txt_attrval").innerHTML = ""; break; } } } function createComboAttribute(){//参数信息 comboAttribute = dhtmlXComboFromSelect("sel_attribute"); comboAttribute.loadXML("../FeeCodes/AttributeAdapter.aspx?mask=0&pos=0"); comboAttribute.attachEvent("onChange", function(){ comboAttribute.setComboText($("h_attrname").value); $("h_attrid").value = comboAttribute.getSelectedValue(); // var attributeObj = null; // var url = "../FeeCodes/AttributeAdapter.aspx?handle=attrinfo&attrid="+$("h_attrid").value+"&uid="+newGuid(); // var loader = dhtmlxAjax.getSync(url); // // var attributeVal = loader.xmlDoc.responseText;//alert(opInfo); // var attributeObj = eval('(' + attributeVal + ')'); // // if(attributeObj.attr.length > 0){ // var selType = $("sel_type"); // selType.options.length = 0; // // selType.add(new Option(attributeObj.attr[0].type,attributeObj.attr[0].type)); // $("h_attrid").value = attributeObj.attr[0].id; // $("h_type").value = attributeObj.attr[0].type; // $("txt_description").value = attributeObj.attr[0].name; // //// if($("h_compattrid").value.trim() == ""){ // switch(attributeObj.attr[0].type){ // case "bool": // $("txt_attrval").innerHTML = "
" // + "
" // break; // case "int": // $("txt_attrval").innerHTML = ""; // break; // case "string": // $("txt_attrval").innerHTML = ""; // break; // } //// }else{ //// var typeID = $("h_typeid").value.trim(); //// for(var i=0;i0){ // s2=s2+2; // } // var s3 = s1.substring(s2); // if(s2>0){ // comboAttribute.setComboText(s3); // $("h_customer").value=s3; // } // else // { comboAttribute.setComboText($("h_attrname").value); // } }); comboAttribute.setComboText($("h_attrname").value); comboAttribute.attachEvent("onKeyPressed", function(keyCode){ if(keyCode!="8"){ var arrayArg = new Array(); setTimeout(function(){ var filterCount = 0; var is = -1; var ishd = $("h_attrname").value.trim(); if("" != comboAttribute.getComboText().trim()){ while("undefined" != typeof comboAttribute.getOptionByIndex(filterCount)){ var comboValue = comboAttribute.getOptionByIndex(filterCount).text.toUpperCase();//.value; var enterValue = comboAttribute.getComboText().trim().toUpperCase(); $("h_attrname").value = comboAttribute.getComboText().trim().toUpperCase(); if(comboValue.indexOf(enterValue) == 0){ comboAttribute.selectOption(filterCount,true,true); is=filterCount; break; } ++filterCount; } if(is==-1){ $("h_customer").value = ishd; alert("无此内容,请重新选择!"); } } },10); } }); comboAttribute.attachEvent("onSelectionChange", function(){ $("h_attrname").value = comboAttribute.getComboText().trim(); $("h_attrid").value = comboAttribute.getSelectedValue(); }); initType(); } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); } //获取GUID function newGuid() { var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); } function switchCheckBox(pushObjName,otherObjName){ if($(pushObjName).checked){ $(otherObjName).checked = false; }else{ $(pushObjName).checked = true; $(otherObjName).checked = false; } }