改变file框样式

  1. <script>   
  2. function fclick(obj){   
  3.   with(obj){   
  4.     style.posTop=event.srcElement.offsetTop   
  5.     var x=event.x-offsetWidth/2   
  6.     if(x<event.srcElement.offsetLeft)x=event.srcElement.offsetLeft   
  7.     if(x>event.srcElement.offsetLeft+event.srcElement.offsetWidth-offsetWidth)x=event.srcElement.offsetLeft+event.srcElement.offsetWidth-offsetWidth   
  8.     style.posLeft=x   
  9.   }   
  10. }   
  11. </script>   
  12. <style>   
  13. input{border:1px solid #333333;color:#666666;background:#eeeeee;font:normal 12px Tahoma;height:18px}   
  14. </style>   
  15. <form method="post" action="" enctype="multipart/form-data">   
  16. <input id="f_file">&nbsp;<input type="button" onmouseover="fclick(t_file)" value="选择上传文件">   
  17. <input name="upload" type="file" style="position:absolute;filter:alpha(opacity=0);width:30px;" id="t_file" onchange="f_file.value=this.value" hidefocus>   
  18. </form>   
  1. da shang
    donate-alipay
               donate-weixin weixinpay

发表评论↓↓