不知道为什么
点 <input name="mail" type="text" id="mail" />就关闭请高手改一下点击不要关闭除非点<div onclick="hideDownloadPanel();" style="right:auto">关闭</div>
才关闭<html>
<head>
<script type="text/javascript">
function S(i) { return document.getElementById(i); }
function download( evt, fid){
 var _event = evt ? evt : event;
 var _target = evt ? evt.target : event.srcElement;
 var _p = S( "downloadPanel" );
 _p.style.top = _event.clientY + document.body.scrollTop ;
 _p.style.left = ( _event.clientX + document.body.scrollLeft < 160 ? _event.clientX + document.body.scrollLeft + 10  : _event.clientX  + document.body.scrollLeft - 120 );
 Show( "downloadPanel" , true ); 
 _p.focus();
}
function Show(obj, bShow) {
 obj = (typeof(obj) == "string" ? S(obj) : obj);
 if (obj) obj.style.display= (bShow ? "" : "none");
}
function hideDownloadPanel( evt ){
 Show( "downloadPanel" ,false); 
}
function checkClick(evt){
 var _target = evt ? evt.target : event.srcElement ;
 var _id = _target.id;
 if( _id == "" ){
  _id = _target.parentNode.id;
 }
 if( _id !="downloadDirect"  &&  _id != "downloadAgent"  &&  _id != "downloadPanel"  &&  _id.indexOf( "downloadFile_" ) < 0  &&  _id.indexOf( "downloadLink_" ) < 0 ){
  Show( "downloadPanel" , false );
 }
}
window.onload = function(){
 document.body.onclick=checkClick;
}
</script>
<style type="text/css">
html,body{
 font-size:12px;
}
img {border:none}
a {color:#4d5d2c;text-decoration:underline;cursor:pointer;}
.pointer {cursor:pointer;}
.right {float:right}
.right img{margin:0 0 0 6px}
.infobar {background:#fff9e3;border:1px solid #fadc80;color:#743e04;margin-bottom:10px;padding:8px 20px 4px 20px;}
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div id="downloadPanel" style="position:absolute;top:0px;left:0px;width:360px;z-index:999;padding:6px 2px 6px 10px;border:1px solid #fb7;display:none;" class="infobar"><div onclick="hideDownloadPanel();" style="right:auto">关闭</div>
 <div > 标题:<input name="title" type="text" id="title" /></div>
 <div style="padding:6px 0 0 0;">信箱:<input name="mail" type="text" id="mail" /></div>
 <div class="addrtitle" style="padding:6px 0 0 0;">内容: <textarea name="content" cols="68" rows="15" id="content"></textarea></div>
  <div class="addrtitle" style="padding:6px 0 0 0;"><input type="submit" name="Submit" value="提交" /> <input type="reset" name="Submit2" value="重置" /></div>
</div>
</form>
<a id="downloadLink_001"  onclick="download( event, 'downloadLink' );" >添加</a><br/></body>
</html>

解决方案 »

  1.   

    为什么层在下拉列表下面 
    解决层在下拉列表上面!
    <html>
    <head>
    <script type="text/javascript">
    function S(i) { return document.getElementById(i); }
    function download( evt, fid){
     var _event = evt ? evt : event;
     var _target = evt ? evt.target : event.srcElement;
     var _p = S( "downloadPanel" );
     _p.style.top = _event.clientY + document.body.scrollTop ;
     _p.style.left = ( _event.clientX + document.body.scrollLeft < 160 ? _event.clientX + document.body.scrollLeft + 10  : _event.clientX  + document.body.scrollLeft - 120 );
     Show( "downloadPanel" , true ); 
     _p.focus();
    }
    function Show(obj, bShow) {
     obj = (typeof(obj) == "string" ? S(obj) : obj);
     if (obj) obj.style.display= (bShow ? "" : "none");
    }
    function hideDownloadPanel( evt ){
     Show( "downloadPanel" ,false); 
    }
    function checkClick(evt){
     var _target = evt ? evt.target : event.srcElement ;
     var _id = _target.id;
     if( _id == "" ){
      _id = _target.parentNode.id;
     }
     if( _id !="downloadDirect"  &&  _id != "downloadAgent"  &&  _id != "downloadPanel"  &&  _id.indexOf( "downloadFile_" ) < 0  &&  _id.indexOf( "downloadLink_" ) < 0 ){
      Show( "downloadPanel" , false );
     }
    }
    window.onload = function(){
     document.body.onclick=checkClick;
    }
    </script>
    <style type="text/css">
    html,body{
     font-size:12px;
    }
    img {border:none}
    a {color:#4d5d2c;text-decoration:underline;cursor:pointer;}
    .pointer {cursor:pointer;}
    .right {float:right}
    .right img{margin:0 0 0 6px}
    .infobar {background:#fff9e3;border:1px solid #fadc80;color:#743e04;margin-bottom:10px;padding:8px 20px 4px 20px;}
    </style>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
    <div id="downloadPanel" style="position:absolute;top:0px;left:0px;width:360px;z-index:999;padding:6px 2px 6px 10px;border:1px solid #fb7;display:none;" class="infobar"><div onClick="hideDownloadPanel();" style="right:auto">关闭</div>
     <div > 标题:<input name="title" type="text" id="title" /></div>
     <div style="padding:6px 0 0 0;">信箱:<input name="mail" type="text" id="mail" /></div>
     <div class="addrtitle" style="padding:6px 0 0 0;">内容: <textarea name="content" cols="68" rows="15" id="content"></textarea></div>
      <div class="addrtitle" style="padding:6px 0 0 0;"><input type="submit" name="Submit" value="提交" /> <input type="reset" name="Submit2" value="重置" /></div>
    </div>
    </form>
    <a id="downloadLink_001"  onclick="download( event, 'downloadLink' );" >添加</a><br/>
    <label>
    &nbsp;&nbsp;&nbsp;&nbsp;<select name="select">
    </select>
    </label>
    </body>
    </html>
      

  2.   


    <html>
    <head>
    <script type="text/javascript">
    function S(i) { return document.getElementById(i); }
    function download( evt, fid){
     var _event = evt ? evt : event;
     var _target = evt ? evt.target : event.srcElement;
     var _p = S( "downloadPanel" );
     _p.style.top = _event.clientY + document.body.scrollTop ;
     _p.style.left = ( _event.clientX + document.body.scrollLeft < 160 ? _event.clientX + document.body.scrollLeft + 10  : _event.clientX  + document.body.scrollLeft - 120 );
     Show( "downloadPanel" , true ); 
     _p.focus();
    }
    function Show(obj, bShow) {
     obj = (typeof(obj) == "string" ? S(obj) : obj);
     if (obj) obj.style.display= (bShow ? "" : "none");
    }
    function hideDownloadPanel( evt ){
     Show( "downloadPanel" ,false); 
    }
    /*function checkClick(evt){
     var _target = evt ? evt.target : event.srcElement ;
     var _id = _target.id;
     if( _id == "" ){
      _id = _target.parentNode.id;
     }
     if( _id !="downloadDirect"  &&  _id != "downloadAgent"  &&  _id != "downloadPanel"  &&  _id.indexOf( "downloadFile_" ) < 0  &&  _id.indexOf( "downloadLink_" ) < 0 ){
      Show( "downloadPanel" , false );
     }
    }
    */
    window.onload = function(){
    S('downloadPanel').innerHTML += "<iframe style='width:100%;height:300px;position:absolute;left:0px;top:0px;z-index:-1;filter:alpha(opacity = 0)'></iframe>"
    }
    </script>
    <style type="text/css">
    html,body{
     font-size:12px;
    }
    img {border:none}
    a {color:#4d5d2c;text-decoration:underline;cursor:pointer;}
    .pointer {cursor:pointer;}
    .right {float:right}
    .right img{margin:0 0 0 6px}
    .infobar {background:#fff9e3;border:1px solid #fadc80;color:#743e04;margin-bottom:10px;padding:8px 20px 4px 20px;}
    </style>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
    <div id="downloadPanel" style="z-index:200;position:absolute;top:0px;left:0px;width:360px;z-index:999;padding:6px 2px 6px 10px;border:1px solid #fb7;display:none;" class="infobar"><div onClick="hideDownloadPanel();" style="right:auto">关闭</div>
     <div > 标题:<input name="title" type="text" id="title" /></div>
     <div style="padding:6px 0 0 0;">信箱:<input name="mail" type="text" id="mail" /></div>
     <div class="addrtitle" style="padding:6px 0 0 0;">内容: <textarea name="content" cols="68" rows="15" id="content"></textarea></div>
      <div class="addrtitle" style="padding:6px 0 0 0;"><input type="submit" name="Submit" value="提交" /> <input type="reset" name="Submit2" value="重置" /></div>
    </div>
    </form>
    <a id="downloadLink_001"  onclick="download( event, 'downloadLink' );" >添加</a><br/>
    <label>
    &nbsp;&nbsp;&nbsp;&nbsp;<select name="select">
    </select>
    </label>
    </body>
    </html>