2010-02-16 50 views
0

此表單在Safari中可用。在IE中,它大部分都可以工作,但是我得到一個錯誤:「對象不支持這個屬性或方法。」在管線240如何解決JavaScript未定義的錯誤?

在Firefox中,未出現警告框,但出現在錯誤控制檯以下錯誤:

錯誤:myForm會沒有定義 線路:240(240線低於,以單詞如果)

<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 - 它現在可以在所有瀏覽器中使用。

+1

什麼呢你腳本標籤的樣子。如果您不恰當地製作腳本標記,就會發生這種情況。 –

+1

更改爲

相關問題