无法正常工作
<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时出现,然后将焦点放回到该文本框上。
您可以通过调用本身传递输入
我建议您解决方法,并使用onblur删除focus()。