博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

flie图片代替方法2

Posted on 2012-11-22 16:12  人生梦想起飞  阅读(192)  评论(0编辑  收藏  举报

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>input file的另类做法</title> 
<style type="text/css"> 
<!-- 
#input1{border:1px solid #0000FF} 
#btn1{width:70px;height:21px;font-size:12px;padding-top:3px;border-left:1px solid #FFFFFF;border-top:1px solid #FFFFFF;border-

right:1px solid #666666;border-bottom:1px solid #666666} 
//--> 
</style> 


</head> 

<body> 
'<div class="inpcen">',//文本框图片
          '<div class="fl">',
            '<input name="RequestFile" style=" flaot:left;width:210px;" id="RequestFile1" type="text" readonly="readonly">',
          '</div>',

 '</div>',
 '<div class="setBottom btnBlue fl"> <a href="javascript:void(0)" id="ImageUploader_Submit_blue"> <span class="spanLeft"></span> <span class="spanRight"></span>浏&nbsp;览 </a><div class="filleBox" style="width:70px;height:30px; position: absolute; top: 0px; left:0px; overflow:hidden"><input name="RequestFile" id="RequestFile" type="file" style="float:left;position: absolute;height: 30px; line-height:30px; opacity:0; font-size: 18px; -moz-box-sizing: border-box; top:0px;filter:alpha(opacity=0); overflow:hidden; cursor:pointer; right:-3px;"></div></div>',
        '</div>',

</body> 
</html>
<script type="text/javascript">
/*
****文本框可以是有背景图片的
**浏览按钮可以是图片,但是必须用file浏览按钮覆盖住,以及定位好(其实就是把他定位到自定义的图片按钮上人后透明度为0)

 $('#RequestFile').bind('change',function(){
                
          $('#RequestFile1').val($(this).val());
          
         })  */

</script>