what would be the best INPUT line to invoke this method on a form field?

Using the following JavaScript function, what would be the best INPUT line to invoke this method
on a form field?
function checkValue(enteredValue) {
var retVal = false
if (enteredValue.value < 0)
alert(“Must be a whole number”)
else if (enteredValue.value > 1000)
alert(“Value must be >0 and less than 1000”)
else
retVal = true
return retVal
}

Using the following JavaScript function, what would be the best INPUT line to invoke this method
on a form field?
function checkValue(enteredValue) {
var retVal = false
if (enteredValue.value < 0)
alert(“Must be a whole number”)
else if (enteredValue.value > 1000)
alert(“Value must be >0 and less than 1000”)
else
retVal = true
return retVal
}

A.
<INPUT TYPE=”text” NAME=”quantity” onChange=”checkValue(quantity.value)”>

B.
<INPUT TYPE=”text” NAME=”quantity” onChange=”checkValue(this.value)”>

C.
<INPUT TYPE=”text” NAME=”quantity” onChange=”checkValue(form.value)”>

D.
<INPUT TYPE=”text” NAME=”quantity” onChange=”checkValue(current.value)”>



Leave a Reply 0

Your email address will not be published. Required fields are marked *