My JS skill are at the very begining, so I appreciate a bit of a patience.?
———————–
Form has more than one entry field.
Function is a part of bigger entity (Ajax data call), but problem should not have anything to do with that.
When user types something into entry field, one image is being replaced by another.
Eg. user types something, when it is longer that 3 chars, blank image is being replaced by another, eg. “ok” or something.
For some reason it can be only once and when given entry field will loose focus and user moves to another entry field, showed below function does not work anymore in neither of entry fields.
Do I need separate functions for every entry field or something?
Anybody can give me a hint why this image switch dies?
Regards,
Jeff
[CODE]
//explanation: inputLen – field input; inputCharLen – chars when reached
//image switch triggered; e- event; imagex – image placeholder being switched
function gifOn(inputLen, inputCharLen, e, imagex) {
var unicode=e.keyCode? e.keyCode : e.charCode
if ((inputLen.value.length >= inputCharLen) && (unicode!=9))
{
document[imagex.name].src = “../admin/images/icons/loader.gif”;
}
//gets unwanted keypresses out
if (
(unicode==38) || //arrow up
(unicode==40) || //arrow down
(unicode==37) || //arrow left
(unicode==39) || //arrow right
(unicode==13) || //enter
(unicode==27) || //escape
(unicode==46) || //delete
(unicode==16) || //shift
(unicode==17) || //ctrl
(unicode==18) || //alt
(unicode==93) || //
(unicode==91) || //
(unicode==20) || //
(unicode==223)
)
{
document[imagex.name].src = “../admin/images/icons/loader_blanc.gif”;
}
if (inputLen.onblur) {
document[imagex.name].src = “../admin/images/icons/loader.gif”;
}
}