Code:
<SCRIPT LANGUAGE=javascript>
function checkTestInput(me,e) {
var complete;
var valueEntered;
complete = me.value;
if(complete!=null || complete.length!=0) {
valueEntered = complete.substring(complete.length-1,complete.length);
if ( (allowedChars.indexOf(valueEntered) == -1) && (checkIfCRLF(e)==false) ) {
Layer501.style.visibility='visible';
Layer500.style.visibility='hidden';
} else {Layer501.style.visibility='hidden'; Layer500.style.visibility='visible';
complete = complete.substring(0, complete.length-1);
}
<!--- me.value = complete; --->
}
}
</SCRIPT>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"><input name="Name" type="text" class="Main" size="20" value="<cfif IsDefined ('session.CheckRequiredOrderFirstName')><cfif #session.CheckRequiredOrderFirstName# IS ''><cfelse>#session.CheckRequiredOrderFirstName#</cfif></cfif>" onBlur="checkTestInput(this,event);"></td>
<td><div name="Layer500" id="Layer500" style="visibility:hidden;width:60px;height:0px">Good</div><div name="Layer501" id="Layer501" style="visibility:hidden;width:60px;height:0px">Bad</div></td>
</tr>
</table>
At the moment, its got 2 divs, and depending on the user input, it displays or hides them. I'd rather work out of one div, with a new image to display in the div (ie. a tick) for a correct input and a cross for a bad input. Also, I want the image to display as soon as the user moves onto the next textbox, so onBlur right?
Thanks
Bookmarks