Hi Ashok,
It look more like you want to set the value of the textbox to a friendly value representing the image they clicked. You could do it using the name field as so:
Code:
<form id="form1" name="form1" method="post" >
<img src="Favourite.gif" name="Favourite" onclick="SetImageName(this.name)"/>|
<img src="Rubbish.gif" name="Rubbish" onclick="SetImageName(this.name)"/>|
<input type="text" value="" id="ImageName" name="ImageName">
</form>
<script language="javascript" type="text/javascript">
function SetImageName(strName)
{
document.getElementById("ImageName").value = strName;
}
</script>
Putting it in a separate function helps keep it manageable. To get the reference to the textbox, use document.getElementById - you will need to add an id property to the textbox, as well as the name.
However, to make it a bit easier, and not have to tie the name of the image to the text you display, you may be better off doing something like this, and just passing the text to display directly into the function:
Code:
<form id="form1" name="form1" method="post" >
<img src="Favourite.gif" onclick="SetImageName('Favourite')"/>|
<img src="Rubbish.gif" onclick="SetImageName('Rubbish')"/>|
<input type="text" value="" id="ImageName" name="ImageName">
</form>
<script language="javascript" type="text/javascript">
function SetImageName(strName)
{
document.getElementById("ImageName").value = strName;
}
</script>
HTH
Phil