改变input file文字,兼容IE firefox

  <input type="button" value="http://wwww.iteye.com" onclick="eventHandler(event)" />
 
  <form action=upload.jsp id=subtitle_formname name=form1 encType='multipart/form-data'  method=post target=subtitle_hide_frame >
   <input id='subtitle_f_file' readonly class='double_input_txt' >
<input id='subtitle_mouseid' class='btn' type='button' onmouseover='fclick(event)' style="width:80px;" value='Browse'>
       <input name='upload' type='file' style='position:absolute;filter:alpha(opacity=0);opacity:0;    
   width:80px;' id='subtitle_t_file' onchange='subtitle_f_file.value=this.value' hidefocus>  
     <input type=text style='display:none' name=outputpath id=subtitle_outputpathid />    
   <input type=text style='display:none' name=upType id=subtitle_upTypeid />
   <iframe name='subtitle_hide_frame' id=subtitle_hide_frame style='display:none'></iframe>
  </form>


fclick=function(e)
{
    var event=$.event.fix(e);

   //alert(obj["offsetLeft"]);
//alert(obj["offsetTop"]);
//alert(obj.style.left);

    document.getElementById("subtitle_t_file").style.left=GetPos(event.target,"Left")+"px";
        document.getElementById("subtitle_t_file").style.top=GetPos(event.target,"Top")+"px";    

}

function GetPos(obj,oType)
{  
    //alert(obj);    
    var pos=obj["offset"+oType];
    var objParent=obj.offsetParent;
    
    while(objParent.tagName.toUpperCase()!="BODY")
    {  
        pos+=objParent["offset"+oType];
        objParent=objParent.offsetParent;  
    }  
//alert(pos);
    return pos;
}



你可能感兴趣的:(IE,firefox)