Click to See Complete Forum and Search --> : operators


lisa_anne
01-10-2003, 10:36 AM
i just need a lil help, how do i restrict the users options to 1- 10?

THIS IS MY EXERCISE FOR UNI

Prompt a user to enter three numbers between 1 and 10, inclusive.

If any of the numbers is EITHER outwith the given range OR is not a number, re-prompt the user to enter another value within the range.


thank you
lisa

rustler2001
01-10-2003, 10:51 AM
now now lisa,
the only way you are going to learn is by doing yourself!
if not have a look at the followig and change it as you wish

<script language="JavaScript">
function validate(f) {

var i; n=0;

// ***** Check for details *****

}
if ((f.elements["A01_1"].value == "")
|| (f.elements["A01_1"].value.indexOf('1') == -1)
|| (f.elements["A01_1"].value.indexOf('2') == -1)){
f.elements["A01_1"].focus();
alert("Please enter a valid number!");
return false;

then repeat the second line all the way to 10 and try that.

lisa_anne
01-10-2003, 11:06 AM
lol, ive been trying this for hours:(