我想檢查在文本框中輸入的字符串的大小。 我錯過了什麼?javascript字符串長度比較
var com = document.getElementById("comment").value;
if(com.lenght <= 100){
alert("good");
} else {
alert("bad");
}
我想檢查在文本框中輸入的字符串的大小。 我錯過了什麼?javascript字符串長度比較
var com = document.getElementById("comment").value;
if(com.lenght <= 100){
alert("good");
} else {
alert("bad");
}
嘗試將長度改爲length。
這是寫長度不長。
拼錯lenght
- 應該是length
誤拼寫:
if(com.lenght <= 100){
使用本:
if(com.length <= 100){
javascrept是令人沮喪的! – 2010-02-05 21:11:34
溢出令人沮喪! – 2010-02-05 21:13:51