【发布时间】:2014-12-01 01:13:43
【问题描述】:
无法让它工作
<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>
这是标签部分。
<form action=''>
<p>Sticker Price on the Car (in dollars):
<input type="text" name="stickerPrice" size="15" onblur="checkPrice(this.formData)" /></p>
</form>
如果 onblur 事件少于 10,000,我希望出现一个警报框,然后将焦点放回该文本框。
【问题讨论】:
标签: javascript validation input focus onblur