<style type="text/css">
<!--
.selecttext {
BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 0px; FONT-FAMILY: arial; BORDER-RIGHT-WIDTH: 0px
}
.selectbutton {
BORDER-RIGHT: #83a5eb 1px solid; BORDER-TOP: #83a5eb 1px solid; FONT-SIZE: 10px; PADDING-BOTTOM: 3px; BORDER-LEFT: #83a5eb 1px solid; WIDTH: 16px; LINE-HEIGHT: 0px; BORDER-BOTTOM: #83a5eb 1px solid; FONT-FAMILY: webdings; HEIGHT: 19px; BACKGROUND-COLOR: #d1e0fd
}
.selecttable {
FONT-SIZE: 12px; CURSOR: default; FONT-FAMILY: arial
}
.selectcontent {
BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; LEFT: 0px; OVERFLOW: auto; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 0px
}
.selectdiv {
OVERFLOW: hidden; WIDTH: 100px; POSITION: absolute
}
.select {
BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; BORDER-BOTTOM: #7f9db9 1px solid; BORDER-COLLAPSE: collapse
}
-->
</style>
<HTML><HEAD><TITLE>test</TITLE>
<SCRIPT>
scHTML='<div id="selectcontent" class="selectdiv" style="visibility:hidden;"><iframe id=selframe frameborder=0 height=100%></iframe><div id="selecthtml" class="selectcontent">select&Aacute;&ETH;±í</div></div>'
document.write(scHTML)
vDiv=selectcontent
vDivHtml=selecthtmlfunction editselect(name,size,defaulttext,width,height,readonly){
  var combo=this;
  this.options=new Array();
  this.name=name;
  this.divname=name+'_div';
  this.buttonname=name+'_button';
  this.tablename=name+'_table';
  this.htmltable=name+'_html' 
  if (!height) this.height=0; else this.height=height
  if (width) this.width=width
  if (!size) size=8
  if (!defaulttext) defaulttext=""
  if (!readonly || readonly==0) {readonly="" }else {if (readonly==1) readonly="readonly style=cursor:default";this.readonly=1}
  esHTML='<div id='+this.divname+'>'
         +'<table id='+this.tablename+' cellpadding=0 cellspacing=0 class=select><tr><td bgcolor=#FFFFFF>'
         +'<input type=text class=selecttext size="'+size+'" name='+name+' value="'+defaulttext+'" '+readonly+'><td><button class=selectbutton id='+this.buttonname+'>6</td></tr></table>'
         +'</div>'
  document.write(esHTML)
  this.sbutton=eval("document.all."+this.buttonname)
  
  if (this.readonly==1) eval(this.name).onclick=function(){combo.show()}  
  
  this.sbutton.onclick=function(){combo.show()}
  this.show=function(){
    pDiv=eval(combo.divname)
    pTable=eval(combo.tablename)
    var vHTML='<table id=htmltable cellspacing="0" cellpadding="2" bgcolor="#ffffff" class="selecttable" width=100%>'
    for (i=0;i<combo.options.length;i++)
      {
       vHTML+='<tr onmouseover="mo(this)" onmouseout="mu(this)" onclick="document.all.'+combo.name+'.value=this.innerText;selectcontent.style.visibility=\'hidden\'"><td nowrap>'+combo.options[i]
      }
     vHTML+="</table>"
    vDivHtml.innerHTML=vHTML   
    vtop=pDiv.offsetTop+pDiv.offsetHeight
    vleft=pDiv.offsetLeft+1   
    vParent = pDiv.offsetParent;
     while (vParent.tagName.toUpperCase() != "BODY")
 {
  vleft += vParent.offsetLeft;
  vtop += vParent.offsetTop;
  vParent = vParent.offsetParent;
 }
   var redge=document.body.clientWidth-vleft
   var bedge=document.body.clientHeight-vtop
 if (!combo.width) {vDiv.style.width=pTable.offsetWidth} else {vDiv.style.width=combo.width}
    if (combo.height==0)
      {
        vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
        vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
      }
      else
      {
         if (htmltable.offsetHeight>combo.height)
          {
            vDiv.style.pixelHeight=combo.height
            vDivHtml.style.pixelHeight=combo.height
            } 
           else 
           {
          
              vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
              vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
           }
   
       }
    
    vDivHtml.scrollTop=0
    
    if (redge<vDiv.offsetWidth)
      vDiv.style.left=vleft-1-(vDiv.offsetWidth-redge)
        else
      vDiv.style.left=vleft-1
         if (bedge<vDiv.offsetHeight)
    //vDiv.style.top=vtop-vDiv.offsetHeight-pDiv.offsetHeight
    vDiv.style.top=vtop-vDiv.offsetHeight+bedge
         else
      vDiv.style.top=vtop
      
    
    vDivHtml.style.width=parseInt(vDiv.style.width)
      vDiv.style.visibility="visible"
  }
  
  this.add=function(text){
     combo.options[combo.options.length]=text
  }
  
  this.about=function(){
  
 }
}
function mo(obj){
//obj.style.backgroundColor="#000099"
obj.style.backgroundColor="#93AAED"
obj.style.color="#ffffff"
}function mu(obj){
obj.style.backgroundColor=""
obj.style.color="#000000"
}document.onmousedown=function(){
if (vDiv.style.visibility=="visible"){
mx=event.x + document.body.scrollLeft
my=event.y + document.body.scrollTop;x1=vDiv.offsetLeft
y1=vDiv.offsetTopx2=vDiv.offsetLeft+vDiv.offsetWidth
y2=vDiv.offsetTop+vDiv.offsetHeightif (mx<x1 || my<y1 || x2<mx || y2<my) 
   { 
     vDiv.style.visibility='hidden'
   }
}
}
</SCRIPT><SCRIPT language=JavaScript type=text/JavaScript>
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</SCRIPT>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD>
<BODY><BR><BR><BR>
<P></P></FORM>
<div id="Layer1" style="position:absolute; width:138px; height:121px; z-index:1; left: 441px; top: 164px;">
  <script>  var zhangtao2
zhangtao2 =new editselect("zhangtao2","17","dm_demo","");
zhangtao2.add("dm_demo")
zhangtao2.add("Kucun")
zhangtao2.add("du_demo")
    </script>
</div>
</BODY>
</HTML>

解决方案 »

  1.   

    我是调用javascript的函数动态生成下拉框的
      

  2.   

    把Z轴改成-1就可以用背影了。                                                                      (这里改成了-1) 
    <div id="Layer1" style="position:absolute; width:138px; height:121px; z-index:-1; left: 441px; top: 164px;">
      

  3.   

    <style type="text/css">
    <!--
    .selecttext {
    BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 0px; FONT-FAMILY: arial; BORDER-RIGHT-WIDTH: 0px
    }
    .selectbutton {
    BORDER-RIGHT: #83a5eb 1px solid; BORDER-TOP: #83a5eb 1px solid; FONT-SIZE: 10px; PADDING-BOTTOM: 3px; BORDER-LEFT: #83a5eb 1px solid; WIDTH: 16px; LINE-HEIGHT: 0px; BORDER-BOTTOM: #83a5eb 1px solid; FONT-FAMILY: webdings; HEIGHT: 19px; BACKGROUND-COLOR: #d1e0fd
    }
    .selecttable {
    FONT-SIZE: 12px; CURSOR: default; FONT-FAMILY: arial
    }
    .selectcontent {
    BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; LEFT: 0px; OVERFLOW: auto; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid; POSITION: absolute; TOP: 0px
    }
    .selectdiv {
    OVERFLOW: hidden; WIDTH: 100px; POSITION: absolute
    }
    .select {
    BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; BORDER-BOTTOM: #7f9db9 1px solid; BORDER-COLLAPSE: collapse
    }
    -->
    </style>
    <HTML><HEAD><TITLE>test</TITLE>
    <SCRIPT>
    scHTML='<div id="selectcontent" class="selectdiv" style="visibility:hidden;"><iframe id=selframe frameborder=0 height=100%></iframe><div id="selecthtml" class="selectcontent">select&Aacute;&ETH;㊣赤</div></div>'
    document.write(scHTML)
    vDiv=selectcontent
    vDivHtml=selecthtmlfunction editselect(name,size,defaulttext,width,height,readonly){
      var combo=this;
      this.options=new Array();
      this.name=name;
      this.divname=name+'_div';
      this.buttonname=name+'_button';
      this.tablename=name+'_table';
      this.htmltable=name+'_html' 
      if (!height) this.height=0; else this.height=height
      if (width) this.width=width
      if (!size) size=8
      if (!defaulttext) defaulttext=""
      if (!readonly || readonly==0) {readonly="" }else {if (readonly==1) readonly="readonly style=cursor:default";this.readonly=1}
      esHTML='<div id='+this.divname+'>'
             +'<table id='+this.tablename+' cellpadding=0 cellspacing=0 class=select><tr><td bgcolor=#FFFFFF>'
             +'<input type=text class=selecttext size="'+size+'" name='+name+' value="'+defaulttext+'" '+readonly+'><td><button class=selectbutton id='+this.buttonname+'>6</td></tr></table>'
             +'</div>'
      document.write(esHTML)
      this.sbutton=eval("document.all."+this.buttonname)
      
      if (this.readonly==1) eval(this.name).onclick=function(){combo.show()}  
      
      this.sbutton.onclick=function(){combo.show()}
      this.show=function(){
        pDiv=eval(combo.divname)
        pTable=eval(combo.tablename)
        var vHTML='<table id=htmltable cellspacing="0" cellpadding="2" bgcolor="#ffffff" class="selecttable" width=100%>'
        for (i=0;i<combo.options.length;i++)
          {
           vHTML+='<tr onmouseover="mo(this)" onmouseout="mu(this)" onclick="document.all.'+combo.name+'.value=this.innerText;selectcontent.style.visibility=\'hidden\'"><td nowrap>'+combo.options[i]
          }
         vHTML+="</table>"
        vDivHtml.innerHTML=vHTML   
        vtop=pDiv.offsetTop+pDiv.offsetHeight
        vleft=pDiv.offsetLeft+1   
        vParent = pDiv.offsetParent;
         while (vParent.tagName.toUpperCase() != "BODY")
     {
      vleft += vParent.offsetLeft;
      vtop += vParent.offsetTop;
      vParent = vParent.offsetParent;
     }
       var redge=document.body.clientWidth-vleft
       var bedge=document.body.clientHeight-vtop
     if (!combo.width) {vDiv.style.width=pTable.offsetWidth} else {vDiv.style.width=combo.width}
        if (combo.height==0)
          {
            vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
            vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
          }
          else
          {
             if (htmltable.offsetHeight>combo.height)
              {
                vDiv.style.pixelHeight=combo.height
                vDivHtml.style.pixelHeight=combo.height
                } 
               else 
               {
              
                  vDiv.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
                  vDivHtml.style.pixelHeight=parseInt(htmltable.offsetHeight)+2
               }
       
           }
        
        vDivHtml.scrollTop=0
        
        if (redge<vDiv.offsetWidth)
          vDiv.style.left=vleft-1-(vDiv.offsetWidth-redge)
            else
          vDiv.style.left=vleft-1
             if (bedge<vDiv.offsetHeight)
        //vDiv.style.top=vtop-vDiv.offsetHeight-pDiv.offsetHeight
        vDiv.style.top=vtop-vDiv.offsetHeight+bedge
             else
          vDiv.style.top=vtop
          
        
        vDivHtml.style.width=parseInt(vDiv.style.width)
          vDiv.style.visibility="visible"
      }
      
      this.add=function(text){
         combo.options[combo.options.length]=text
      }
      
      this.about=function(){
      
     }
    }
    function mo(obj){
    //obj.style.backgroundColor="#000099"
    obj.style.backgroundColor="#93AAED"
    obj.style.color="#ffffff"
    }function mu(obj){
    obj.style.backgroundColor=""
    obj.style.color="#000000"
    }document.onmousedown=function(){
    if (vDiv.style.visibility=="visible"){
    mx=event.x + document.body.scrollLeft
    my=event.y + document.body.scrollTop;x1=vDiv.offsetLeft
    y1=vDiv.offsetTopx2=vDiv.offsetLeft+vDiv.offsetWidth
    y2=vDiv.offsetTop+vDiv.offsetHeightif (mx<x1 || my<y1 || x2<mx || y2<my) 
       { 
         vDiv.style.visibility='hidden'
       }
    }
    }
    </SCRIPT><SCRIPT language=JavaScript type=text/JavaScript>
    <!--
    function MM_reloadPage(init) {  //reloads the window if Nav4 resized
      if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
        document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
      else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
    }
    MM_reloadPage(true);
    //-->
    </SCRIPT>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <META content="Microsoft FrontPage 5.0" name=GENERATOR></HEAD>
    <BODY><BR><BR><BR>
      <div id="Layer1" style="position:absolute; width:200; height:115; z-index:-1; left: 259; top: 191; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000">       <SCRIPT>  var zhangtao2
    zhangtao2 =new editselect("zhangtao2","17","dm_demo","");
    zhangtao2.add("dm_demo")
    zhangtao2.add("Kucun")
    zhangtao2.add("du_demo")
    zhangtao2.add("dm_demo1")
    zhangtao2.add("Kucun1")
    zhangtao2.add("du_demo1")
        </SCRIPT>
    </div>
    <P></P></FORM>
    </BODY>
    </HTML>
      

  4.   

    可输入下拉框(20041126)(相似高亮显示,不相似移除)
    http://jkisjk.vip.sina.com/html/EditableSelect1.htm可输入下拉框(20041126)(相似高亮显示,不相似不移除)
    http://jkisjk.vip.sina.com/html/EditableSelect2.htm