Hello raghuprasad,
Chris is right, this is a Java forum, not a JavaScript forum. The two languages are different.
I think I can help you with this one though regardless..
If you were to do this with JavaScript, all you need to do is add a 'onclick' to the href link which calls the desired function.
For example, create the upload function and put it on your page:
<SCRIPT language="JavaScript">
<!--hide
function upload()
{
//upload code here
}
//-->
</SCRIPT>
Then on your href link:
<a href="javascript:upload()">Attach an image</a>
When the 'Attach an image' link is clicked, the upload function is called.
Do a Google search on how to upload files using Javascript
javascript upload file - Google Search