< Html >
< Head >
< Title > Upload </ Title >
< Style >
<! --
. Addfilea {
Position : Relative ;
Cursor : Hand ;
Text-Decoration : None ;
Background-Image : URL ('C: \ windows \ zapotec.bmp ') ;
Width : 20px ;
}
. Addfilei {
Cursor : Hand ;
Position : Relative ;
Left : 0px ;
Width : 20px ;
Background-color : Blue ;
Opacity : 0 ;
Filter : Alpha (opacity = 0)
}
-->
</ Style >
</ Head >
< Body >
< Form Method = Post Action = "Http: // localhost: 8080/upload. jsp" Enctype = "Multipart/form-Data" >
< A Hidefocus class = Addfilea ID = Acomposeattach Href = "#" > & Nbsp; < Input Hidefocus class = Addfilei Type = File Size = 1 Name = "FF" Onchange = "This. Form. Submit ()" > </ A >
< Input Type = "Submit" Value = "Submit" >
</ Form >
</Body>
</Html>
the input type = file control cannot use JavaScript to trigger the click event, otherwise it will not take effect. My Code actually makes it look like a picture is clicked, but the actual click is the transparent input type = file