Having trouble getting this to work
<script type="text/javascript">
//<![CDATA[
<!--
function checkPrice(form) {
var input=0;
input=document.stickerPrice.value;
if (input<100000) {
alert("Sticker price must be more than $100,000");
document.getElementsByName("stickerPrice").focus();
}
}
// -->
//]]>
</script>
and heres the label part.
<form action=''>
<p>Sticker Price on the Car (in dollars):
<input type="text" name="stickerPrice" size="15" onblur="checkPrice(this.formData)" /></p>
</form>
I want an alert box to come up if its less than 10,000 with the onblur event and then place focus back onto that text box.
You can pass the input itself by calling
then you can check for its value directly by calling
and focus by
here is a working sample.