Question:What would be the use of the following code?
function validate(field) { var valid=''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz''; var ok=''yes''; var temp; for(var i=0;i<field.value.length;i++) { temp='''' + field.value.substring(i,i+1) if(valid.indexOf(temp)==''-1'') { ok=''no''; } } if(ok==''no'') { alert(''error''); field.focus(); } }
A It will force a user to enter only numeric values
B It will force a user to enter only alphanumeric values
C It will force a user to enter only character values
D None of the above
+ AnswerC
+ Report