Click to See Complete Forum and Search --> : Browse Button
Youngblood_97
07-09-2003, 03:35 PM
I am having a hard time trying to code a custom browse button. I am looking for a way to attach a script to a graphic button I created and have it function like a regular browse button so someone can select a file. Can anyone please help me?? Those grey browse buttons are ugly. Thanks in advance!!!
:confused:
h_monteiro
07-09-2003, 03:41 PM
<input type=image alt="Continue to next step" src="yourimage.gif" width="101" height="36" >
switch the above element with your submit button on your form.
Should work fine,
Horacio
kdcgrohl
07-09-2003, 07:41 PM
may be wrong here, but i didnt think you could do ANYTHING to a type=file form element.
Youngblood_97
07-10-2003, 07:24 AM
Ya this did not work. Anyone else have any ideas on how I could do this?? Thanks
:confused:
metrosoccer12
07-10-2003, 07:37 AM
u cant make the browse button an image but there is a way to get around it, use this code:
<input type="image" src="IMAGE URL" onclick="document.getElementById('*****').click();return false;">
now hide ur browse button, u still have to have the regualr browse button on the page u can set the width to 0 or u can hide ur browse button by using this code:
<div style="width:0;height:0;overflow:auto">
<input type="file" ..........................................
</div>
now in the first code change "*****" to the "name" of the browse button
Youngblood_97
07-10-2003, 03:25 PM
did it!! :) thanks for everyones help here is the code in case anyone is interested.
<table width="574" border="0" cellspacing="0" cellpadding="0">
<form action="" name="browseform">
<tr>
<td width="20"><img src="images/spacer.gif" width="20" height="8"></td>
<td width="249" height="40" valign="middle"><p>Location of file
<input name="browsetext" type="text" id="browsetext">
or </p>
</td>
<td width="213" valign="middle"><br><br>
<img src="images/browse_button.gif" onclick="document.getElementById('browsebutton').click();return false;">
<div style="width:0;height:0;overflow:auto">
<input type="file" name="browsebutton" onchange="document.browseform.browsetext.value=document.browseform.browsebutton.value"/>
</div>
</td>
<td width="92" height="40" valign="middle"><div align="right"><img src="images/validate_button.gif" width="89" height="29"></div>
</td>
</tr>
</form>
</table>
Youngblood_97
07-16-2003, 08:20 AM
Anyone know why I might be getting an access denied error when I try to add the contents from the text field to the server?? But, if you hit the add button 4 or 5 times it goes through. Is this a problem with bwrose code or is this a server related problem??