⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qinput.htc

📁 HTC,demo WEB用于。 超大型
💻 HTC
📖 第 1 页 / 共 2 页
字号:
      if(dicListAppearFlag) 
        if(objList){
          objList.focus();    
        //////////////////////////////////////////////
        //////////////////////////////////////////////
          if(firstSelectedFlag){//首次选中                    
              iCode = objList.options[0].value;
              iText = objList.options[0].text; 
              getRByIndexInCurNodesList(0);
              objInput.value = iText;
              firstSelectedFlag = false;
          }else{//非首次选中
              saveSelectValue();
          } 
       }
      ////////////////////////////// 
        ///////////////////////////////  
      boolKeyUpDownBlur = false;
      event.keyCode = 0;            
    }//End of if keyCode
    
    if(event.keyCode == "8"){//如果按下的是backspace键
    
			if(objInput.value == ""){
				hideList();
			}      
    }
  
  }

  function secContent(){//响应onkeydown事件
    ////////////////////////////////////////
    if(event.keyCode == "27"){//ESC
      if(dicListAppearFlag){//下拉框显示 
        hideList();
      }
    }
    ////////////////////////////////////////
    
    if(event.keyCode=="40" || event.keyCode=="38"){//上下光标键        
      if(dicListAppearFlag){//下拉框显示 
        boolKeyUpDownBlur = true;    
        if(objList) objList.focus();
        boolKeyUpDownBlur = false;       
      }
    }//End of if keyCode
    
    if(event.keyCode=="13" && objInput.value != ""){//回车键并且输入内容不为空     
      if(dicListAppearFlag){
        if(objList && objList.selectedIndex != -1){
          iCode = objList.options[objList.selectedIndex].value;
          iText = objList.options[objList.selectedIndex].text; 
          objInput.value = iText;            
          objInput.focus();
          getRByIndexInCurNodesList(objList.selectedIndex);
          hideList(); //回车键(13)隐藏下拉框            
        }
      }           
    }//End of if keyCode
}//End of secContent
  
  function getRByIndexInCurNodesList(index){//从oCurNodesList中返回索引为index的r行对象
    oCurR = oCurNodesList[index];        
  }

  function getAttribute(attName){//获得当前选中内容所在r行指定属性名的属性值
    if(typeof(attName)!="undefined" && oCurR){
      return oCurR.getAttribute(attName);
    }else{
      return "";
    }           
  }

  function getList(objRNodeList){//根据传入的NodeList对象装配一个select返回
  
      var tmpStr;
      tmpStr = "<select class='phms_qinput_select' size='" + Lheight + "'>";
      
      if(typeof(objRNodeList) == "undefined" || objRNodeList==null) return(-1);
      if(!strXSLT) return(-1);
      
      tmpStr = "<select class='phms_qinput_select' size='" + Lheight + "'>" + __objGlobalCommonInst.transformDicXML(objXMLDoc,strXSLT) + "</select>";       
      //tmpStr = tmpStr.replace(/[^\S]{0,}[\s]{0,}[^\S]{0,}/g,"").replace(/optionvalue/g,"option value").replace(/selected/g," selected").replace(/selectclass/g,"select class").replace(/size/g," size");
      //tmpStr = tmpStr.replace(/[\s]{4,4}/g, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;").replace(/[\s]{3,3}/g, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;").replace(/[\s]{2,2}/g, "&nbsp;&nbsp;&nbsp;&nbsp;");
      return tmpStr;
  }


  function locationQInput(){ //处理QInput的定位

    var maxRight;
    var maxHeight;
    
    try{

      //上下反转
      maxHeight = element.parentElement.clientHeight - element.offsetTop - element.offsetHeight - objList.offsetTop;
      if(objList.clientHeight>maxHeight){
        if(element.offsetTop >= objList.clientHeight){
          oList.style.top = - objList.offsetHeight;
        }
      }else{//恢复默认
        oList.style.top = objInput.offsetTop + vHeight - 1;
      }

      //左右反转
      maxRight = element.parentElement.clientWidth - element.offsetLeft - element.offsetWidth - objList.offsetLeft;
      if(objList.offsetWidth >maxRight){
        oList.style.left = objInput.offsetLeft + objInput.offsetWidth - objList.offsetWidth ;
      }else{
        oList.style.left = objInput.offsetLeft;
      }
      
    }catch(e){
      //丢弃错误
    }
  }


    function inputXML(argSource){ //objXMLDoc接收XML文件数据  
	initGlobalCommon();  
      return __objGlobalCommonInst.inputXML(argSource);       
    }  

  function refresh(){//定义QInput外框样式   
      
    with(element){//element的位置、样式
      style.top = vTop;
      style.left = vLeft;
      style.pixelHeight = vHeight;
      style.pixelWidth = vWidth;      
    }
    
    with(oDiv){//oDiv的位置、样式
      style.pixelHeight = parseInt(vHeight) - 2;
      style.pixelWidth =  vWidth;             
      //onmousedown = lostFocus;     
    }
    
    with(objInput){//QInput的位置、样式
      style.left = oCaption.offsetWidth;
      style.pixelHeight = parseInt(vHeight) - 2;
      style.pixelWidth = parseInt(vWidth) - oCaption.offsetWidth;          
      onblur = onObjInputLostFocus;
      onkeydown = onInputKeyDown;//仅处理下光标键
      onkeyup = ifShowList;
      
      ////////////////////////////////
      if(vReadOnly.toString().toLowerCase() == "true"){//
        disabled = true;
        objInput.style.borderColor = "#cccccc";
      }else{
        disabled = false;
        objInput.style.borderColor = "#7B9EBD";
      }
    }
    
    with(oList){//下拉框的位置、样式
      style.left = objInput.offsetLeft;
      style.top = objInput.offsetTop + vHeight;
      style.pixelWidth = objInput.offsetWidth;
      style.visibility = "hidden";
    }
  }
  
  function clickList(){//鼠标单击下拉框事件处理
    try{    
        //debugger;
        iCode = objList.options[objList.selectedIndex].value;
        iText = objList.options[objList.selectedIndex].text;   
        
        getRByIndexInCurNodesList(objList.selectedIndex);   
        objInput.value = iText;       
        //alert(iText);
        ///hzh 2004-04-22////////
        evtonItemSelected.fire();
        ///////////////
        vKeyCode = objInput.value;
        hideList();
      }catch(e){
        //alert("clickList错误丢弃");
      }//End of try
  }
  
  function initGlobalCommon(){//初始化__objGlobalCommonInst
  
    var oWindow;
    if(!element.document.parentWindow.__objGlobalCommonInst){//如果还没有初始化      
      oWindow = element.document.parentWindow;
      oWindow.__objGlobalCommonInst = oWindow.parent.__objGlobalCommonInst;
      __objGlobalCommonInst = oWindow.__objGlobalCommonInst;                  
    }                
  }
  
  function initialize(){//初始化操作

    //对象建立 
    oDiv = element.document.createElement("<div class='phms_qinputDiv'/>");//create div
    oDiv = element.appendChild(oDiv);
      
    oCaption = element.document.createElement("<div class='phms_qinputCaption'/>");//create caption
    oCaption = oDiv.appendChild(oCaption);     
    oCaption.innerText = vCaption;
        
    objInput = element.document.createElement("<input class='phms_qinputInput'/>");//create input
    objInput = oDiv.appendChild(objInput);
      
    oList = element.document.createElement("<div class='phms_qinputList' TABINDEX='999'/>");//create list
    oList = element.appendChild(oList);
    
    refresh();    
    element.runtimeStyle.visibility = "visible";  
  }


  function putCaption(argCaption){
    this.vCaption = argCaption;
  }

  function putTop(argTop){
    this.vTop = argTop;
  }

  function putLeft(argLeft){
    this.vLeft = argLeft;
  }

  function putWidth(argWidth){
    this.vWidth = argWidth;
  }

  function putHeight(argHeight){
    this.vHeight = argHeight;
  }


  function putXMLSource(argSource){    
    objXMLDoc = inputXML(argSource);
  }
  
  function getXMLSource(){
    return objXMLDoc;
  }  

  function putCodeCol(argValue){
    vCode = argValue;
  }

  function putTextCol(argValue){
    vText = argValue;
  }

  function putLheight(argValue){
    Lheight = argValue;
  }

  function putLwidth(argValue){
    Lwidth = argValue;
  }

  function getValue(){
    if(oCurR){
      return oCurR;   
    }else{
      return null;
    }         
  }
  
  function putReadOnly(arg){//设置readOnly属性

    vReadOnly = (arg.toString().toLowerCase() == "true")?true:false;
    
    if(objInput){
      if(vReadOnly.toString().toLowerCase() == "true"){//
        objInput.disabled = true;
        objInput.style.borderColor = "#cccccc";
      }else{
        objInput.disabled = false;
        objInput.style.borderColor = "#7B9EBD";
      }
    }   
    
  }
  
  function getReadOnly(){
    return vReadOnly;
  }

  function putValue(anyR){ 

    var vXPath;
    var viewText = "";
    var keyValue = "";
    
    switch(typeof(anyR)){//传入r行的类型
      case "string"://字符串
        if(anyR == ""){
          objInput.value = "";
          iText = "";
          oCurR = null;
          return;
        }else{
          anyR = inputXML("<root>" + anyR + "</root>");
        }        
        break;
      case "object"://对象
        anyR = inputXML("<root>" + anyR.xml + "</root>");
        break;
      default:
        break;
    } 
   
    keyValue = anyR.childNodes(0).childNodes(0).getAttribute(vCode);
    vXPath = "/*/r[@" + vCode + "='" +  keyValue + "']";
    oCurR = objXMLDoc.selectSingleNode(vXPath);       
        
    if(oCurR){//
      viewText = oCurR.getAttribute(vText);//从字典中查找出该属性值进行
    }
        
    if(objInput){//
      objInput.value = viewText;
    }    
    iText = viewText;    
  }
  
  function putText(argText){
    if(objInput) objInput.value = "";
    iText = "";
    oCurR = null;
    if(dicListAppearFlag){
      hideList();
    }  
  }

  function getText(){
    /*
    if(iText)
      return iText;
    else
      return "";
    */
    return(objInput.value);
  }
    
</script>

</public:component>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -