Provide thousands of free JavaScript code examples, DHTML, HTML JavaScript Tutorials, Reference and Help. JavaScriptBank.com is the best JavaScript resources
Over 2000+ free Javascript at JavaScriptBank.com Website
q1aq1bq1cq1dq2aq2bq2cq2dq2e
To use the validation, call rankem(a,b) where the parameters are the question number and its length. In this case, the form handler calls the function twice:
rankem(1,4);rankem(2,5);
Each call will generate a separate alert if there's anything amiss. The global "badrank" variable is a status flag so the main form handler knows if it's allowed to submit(). Note that this demo doesn't acutally do a submit(); instead it just displays a message.