Using javascript in JSF

Hi,

I need to change an image which is after the textbox, when onblur event occurs using javascript in JSF.

<h:inputText size="30" id="j_username" value="#{focal.j_username}"

onblur="changeImage()" >

<h:graphicImage id="idImage" value="/images/circleDash.gif" height="15" width="15"/>

what should be the code in the function changeImage() ?

Thanks in Advance,

Satish.

[631 byte] By [Satish_Pa] at [2007-11-27 3:58:20]
# 1
This has nothing to do with JSF nor with Java. In the changeImage() you just need to write simple plain vanilla Javascript.
BalusCa at 2007-7-12 9:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hi Balucs,I am giving like this in the js function:document.getElementById("idImage").value="new image". but it is not working. is there any way to do it.thanks.
Satish_Pa at 2007-7-12 9:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Look in the generated HTML source for the actual ID.I'd rather to use the 'this' reference however.
BalusCa at 2007-7-12 9:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi BalusC,

I checked the element id. it is standardOptions:idImage

so I gave like this..

var image = document.getElementById("standardOptions:idImage");

but giving .. image.value or image.src ="new image" is not working.

how to change the source for the image.

thanks.

Satish_Pa at 2007-7-12 9:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
image.src should work. Maybe you're doing or interpreting something wrong. This should change the image when the input field loses it's focus.
BalusCa at 2007-7-12 9:02:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...