<input type="file" style="position:absolute;filter:alpha(opacity=0)" hideFocus onpropertychange="document.getElementById('ice').value=this.value"/>
<input type="text" style="width:152px" id="ice"/>
<img src="http://community.csdn.net/logo/images/ajax-in-action.JPG" height="20" align="absmiddle"/>
<input type="text" style="width:152px" id="ice"/>
<img src="http://community.csdn.net/logo/images/ajax-in-action.JPG" height="20" align="absmiddle"/>
<div style="position:absolute;top:15;left:-80;width:150;filter:alpha(opacity=0)" >
<input type="file" onpropertychange="a.value=this.value" size=33></div>
function fclick(obj){
with(obj){
style.posTop=event.srcElement.offsetTop
var x=event.x-offsetWidth/2
if(x<event.srcElement.offsetLeft)x=event.srcElement.offsetLeft
if(x>event.srcElement.offsetLeft+event.srcElement.offsetWidth-offsetWidth)x=event.srcElement.offsetLeft+event.srcElement.offsetWidth-offsetWidth
style.posLeft=x
}
}
</script>
<style>
input{border:1px solid #333333;color:#666666;background:#eeeeee;font:normal 12px Tahoma;height:18px}
</style>
<form method="post" action="" enctype="multipart/form-data">
<input id="f_file"> <input type="button" onmouseover="fclick(t_file)" value="选择上传文件">
<input name="upload" type="file" style="position:absolute;filter:alpha(opacity=30);width:30px;" id="t_file" onchange="f_file.value=this.value" hidefocus>
<br><input type="submit" value="提交">
</form>
先把input=file的隐藏,再用文本框来实现