呵呵,不想多说啥了.....combo就是input和select的结合

解决方案 »

  1.   

    to net_lover(孟子E章)老大
    全部贴出来,实在不太可能太多了,而且全贴出来,我就要去坐牢了
    我试着尽量整理出来。
      

  2.   

    to net_lover(孟子E章)老大
    全部贴出来,实在不太可能太多了,而且全贴出来,我就要去坐牢了--0000
    我试着尽量整理出来
    ---------==================-------------------=======================----------
    说明你的意图吧.
    如果说白夜花寒的那个意思的话
    js就比较容易做到了.
    直接onclick触发层
    我的想法
      

  3.   

    你可以参考
    http://www.mozilla.org/docs/web-developer/
    看看非IE的写法
      

  4.   

    先感谢各位的回复。
    先说明一下,原程序不是我所写,我接手也不过10几天。我只是负责将其改的能在IE上正确运行。
    再说一下这个combobox的意图,我个人的理解可能有欠缺,望大家见谅。原程序作了一个table,不同的列具有不同的属性,比如第一列是不可修改的文字,第二列是Text数字,第三列则是combobox。
    当点击第三列上的cell时,就出现combobox并可以选择或输入。我下午整理了一下,作了一个HTML,我是按照原程序做的希望大家帮我看一看
    运行时先按下[Call insertComboBox()]按钮,会出现一个所谓的combo(很丑陋),然后将鼠标点入text部分。点击text以外的部分,combo会消失。程序原意是点击那个按钮会有下拉菜单,可现在点击那个按钮combo也会消失,而且IE上还会像死机一样,没有动作。而完整的原程序在Netscape上很正常
    点击text以外的部分(除按钮),combo会消失。而点击按钮时不会进入blur_ComboBox。
    ------------------------------------------------------------------------
    <HTML>
    <HEAD>
    <TITLE> combo sample </TITLE>
    <script type="text/javascript">
    var _dom = (document.all ? (document.getElementById ? 2 : 1) :
        (document.getElementById ? 4 : (document.layers ? 3 : 0)));function setDivVisibility(div, visible) {
      if (_dom == 4 || _dom == 2 || _dom == 1) {
        div.style.visibility = (visible) ? 'inherit' : 'hidden';
        return;
      }
      if (_dom == 3) {
        div.visibility = (visible) ? 'inherit' : 'hide';
        return;
      }
    }
    function ComboBox(blurFunc) {
      this.type = "combo";
      this.blurFunc = blurFunc;
      this.visibility = false;  this.options  = new Array();
      this.expops   = new Array();
      this.value    = "";
      this.setFocus = setFocus_ComboBox;
      this.setVisibility = setVisibility_ComboBox;
      this.getVisibility = getVisibility_ComboBox;
      this.create();
    }function setFocus_ComboBox() {
      this.txtview.focus();
    }function setVisibility_ComboBox(visible) {
      this.visibility = visible;
      setDivVisibility(this.lyr, visible);
    }function getVisibility_ComboBox() {
      return this.visibility;
    }ComboBox.prototype.create = function() {
      this.lyr = document.createElement("DIV");
      this.lyr.style.position='absolute';  this.txtview = document.createElement("INPUT");
      this.txtview.name = "SPComboBox";
      this.txtview.id   = "SPComboBox";
      this.txtview.className = "combo-input";
      this.txtview.parent = this;
      this.txtview.onblur = blur_ComboBox;
      this.lyr.appendChild(this.txtview);
            
      this.valcon = document.createElement("INPUT");
      this.valcon.type = "hidden";
      this.lyr.appendChild(this.valcon);  this.button = document.createElement("BUTTON");
      this.button.appendChild(document.createTextNode('I'));
      this.button.className = "combo-button";
      this.button.style.position = "absolute";
      this.button.parent = this;  this.lyr.appendChild(this.button);
      this.button.onfocus = function () {
        //alert("[button.onfocus] start ... ");
        this.blur(); 
      };
      
      this.button.onmousedown = this.toggle;  this.txtview = this.lyr.childNodes[0];
      this.valcon  = this.lyr.childNodes[1];  document.body.appendChild(this.lyr);
    }ComboBox.prototype.toggle = function() {
      //alert("[toggle] start ... ");
    }function blur_ComboBox() {
      //alert("[blur_ComboBox] start ... ");
      var theCombo = this.parent;
      
      if (theCombo != null) {
        if (theCombo.blurFunc) {
          theCombo.blurFunc();
        }    theCombo.setVisibility(false);
      }
    }
    function insertComboBox() {
      var combox = new ComboBox(onBlurFunc);
    }function onBlurFunc() {
      //alert("[onBlurFunc] start...");
    }</script></HEAD><BODY">
    <button onclick="insertComboBox();">Call insertComboBox()</button>
    </BODY>
    </HTML>
    -------------------------------------------------------------------------