2010-05-13 4 views

답변

18

누구든지 브라우저에서 수행하는 작업을 브라우저에서 변경할 수 있으므로 JavaScript 유효성 검사가 안전하지 않습니다. 시각적 경험을 향상시키기 위해 그것을 사용하는 것은 괜찮습니다.

var textBox = document.getElementById("myTextBox"); 
var textLength = textBox.value.length; 
if(textLength > 5) 
{ 
    //red 
    textBox.style.backgroundColor = "#FF0000"; 
} 
else 
{ 
    //green 
    textBox.style.backgroundColor = "#00FF00"; 
} 
관련 문제