Hi im zee and i'm new to javascript..
The javascript function below..examines if a string value contains only numbers..
My problem is..I can't figure out why it doesn't continue with the 2nd loop and iterate j..please help.!
<script language="javascript">
<!--
value = "23e";
isNumber(value);
function isNumber(value){
document.write('I\'m inside the function isNumber' + '</br>');
document.write('The value = ' + value + '</br>' );
document.write('The length of value = ' + value.length);
var isAllValid=true; document.write(isAllValid);
var validChars="0123456789"; document.write('</br>' + 'validChars = ' + validChars + '</br>');
var current = "";
for(i=0; i<value.length; i++){
current = value.charAt(i);
document.write('current = ' + current + '</br>');
for(j=0; j<validChars.length; j++){
document.write('j = ' + j + '</br>');
document.write('current = ' + current + ' ' + 'validChars = ' + validChars.charAt(j) + '</br>');
if(current == validChars.charAt(j)){
document.write('break!');
break;
}
if(j==validChar.length){
document.write('oops! 1-9 evaluated...no match');
isAllValid=false;
break;
}
}
}
return isAllValid;
}
-->
</script>