A
Andyza
This function checks if a string contains commas or dots. Is there a
simpler, better way to write the function?
function CheckCharacters(x) {
var CharPos = x.indexOf(",")
if (CharPos != -1) {
alert("String contains commas.");
}
CharPos = x.indexOf(".")
if (CharPos != -1) {
alert("string contains dots.");
}
}
I call it using:
<form name="myForm" ... >
....
<input type="text" name="txtBox"
onBlur="CheckCharacters(myForm.txtBox.value)">
....
</form>
Thanks.
simpler, better way to write the function?
function CheckCharacters(x) {
var CharPos = x.indexOf(",")
if (CharPos != -1) {
alert("String contains commas.");
}
CharPos = x.indexOf(".")
if (CharPos != -1) {
alert("string contains dots.");
}
}
I call it using:
<form name="myForm" ... >
....
<input type="text" name="txtBox"
onBlur="CheckCharacters(myForm.txtBox.value)">
....
</form>
Thanks.