[英]How do I resolve JavaScript error “not defined”?
此表單可在Safari中使用。 在IE中,它通常可以正常工作,但是出現錯誤“對象不支持此屬性或方法”。 在第240行。
在Firefox中,沒有出現警告框,但錯誤控制台中出現以下錯誤:
錯誤:未定義myform行:240(下面是第240行,以單詞if開頭)
<script type="text/javascript">
// Validate the form
// Confirm with the visitor the amount he entered is correct
// Submit if OK is pressed
$(document).ready(function() {
$("#myform").validate({
submitHandler:function(form){
if(confirm("Please confirm your donation of $"+ myform.x_Amount.value + " to us.")){
form.submit();
}
}
});
});
// Put grey "no spaces" example text in the credit card number field
$('#x_Card_Num').example('(NoSpaces)', {
className: 'greydefaulttext'
});
</script>
猜猜我需要定義myform.x_Amount.value。 嘗試過以各種方式執行此操作,但尚未偶然找到正確的位置來定義它,甚至沒有正確的語法。 謝謝你的幫助。
更新:由於RC和Bobince的嶄新眼光,這只是一個錯字:myform.x_Amount.value應該命名為form.x_Amount.value-現在它在所有瀏覽器中都可以使用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.