2016-08-07 5 views
0

스타일의 다른 부분을 변경하는 데이 방법을 사용했지만 어떤 이유로 입력 필드의 색상이 변경되지 않습니다 .... style.background-color와 같은 방식으로 변경할 수 있습니까? "red "; ? 다른 질문은 실제 텍스트 상자 자체보다는 내 오류 메시지가 강조 표시된 공간을 만드는 것처럼 보입니다.CSS를 사용하여 입력 텍스트 필드에서 색상을 변경하는 방법은 무엇입니까?

JS

if (document.getElementById("telno").value == /^\d+$/) { 
      document.getElementById("errtelno1").style.display = "inline"; 
      document.getElementById("errtelno1").style.visibility = "visible"; 

이 순간

.error{ 
display: none; 
color: #FF2121; 
font-family: arial; 
font-size: 14px; 
font-weight: bold; 
} 

h1{ 
font-style: normal; 
font-weight: bold; 
font-size: 20px; 
font-family: Lucida Sans Unicode; 
color: #0A032F; 
text-align: center; 
text-decoration: underline; 
} 

h2{ 
font-weight: bold; 
font-size: 18px; 
font-family: arial; 
color: #33257B; 
text-align: center; 
text-decoration: underline; 
} 

p{ 
font-family: arial; 
font-size: 14px; 
} 

fieldset{ 
margin-left: 400px; 
margin-right: 400px; 
margin-top: 40px; 
text-align: center; 
border: 1px solid #000000; 
background: linear-gradient(#ffffff, #f2f2f2); 
}  


label{ 
font-family: arial; 
font-size: 14px; 
display: inline; 
} 

.formfield{ 
margin-left: 25px; 
display: inline; 
} 

#title{ 
margin-left: 25px; 
display: inline; 
} 
+0

이것은 실제 입력 필드 텍스트 상자가 아니라 옆에있는 오류를 비우는 것처럼 보입니까? – Jiyl

답변

1

예 수의 CSS,

이 시도

document.getElementById("errtelno1").style.backgroundColor ='red';

희망입니다 이게 도움이됩니다!

관련 문제