> The following works only in Internet Explorer, not in > Mozilla, Netscape or Opera. Anyone have any idea how to fix it? > > > <html:form method='POST' enctype='multipart/form-data' > action='/upload'> > <html:file property='browse' value='' style='display: none;' /> > <html:text property='file' value=''/> > <html:button property='whatever' > onclick='browse.click();file.value=browse.value;browse.disabled=true' > value='Select a File...'/>
Mozilla hues to the W3C standard for addressing items in the DOM. That means that instead of using the easier syntax that IE accepts, you have to find an item using the get ElementById function. So write a JavaScript function that looks something like this: Function getFile() { fileCtrl = document.getElementById("browse"); textCtrl = document.getElementById("file"); fileCtrl.click(); textCtrl.value = fileCtrl.value; } And call it from the onclick property of your button. I suspect you're going to have to get a bit fancier, because you don't want to assign the value until the user has changed the value of the file selector. Maybe an onChange handler in that control? -- Tim Slattery [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]