Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FireFox input type="file" .click()?

Status
Not open for further replies.

gfbj

Programmer
Dec 13, 2002
3
0
0
US
IE supports .click() on an

input type="file"

field/button combination. How do I get that behavior with FireFox? I am overlaying the actual input field and browse button with a span having a dummy input field/button combination that lists valid extensions and when a user clicks either of the dummy elements the containing span gets styled display:none and the real field and Browse buttons are displayed.

I also want to trigger the real Browse button's .click() event and open the OS command window to browse to the desired file as if the use had simply clicked the real button. This works for IE but in FF the dummy field goes away and the user has to click again on the real Browse button to open the command window.

function showBrowse(){
var oDummy=document.getElementById('spnDummyFileBrowse');
var oBrowse=document.getElementById('inpFileBrowse');
oDummy.style.display='none';
oBrowse.style.display="";
oBrowse.click();// <--- This works for IE but not FireFox??????
}
 
Relates to 2006 closed thread: thread216-1277680
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top