经典指数          
原因
4704
浏览数
0
收藏数
 

下列js可以让一个input的背景颜色变成红色的是?
  • inputElement.style.backgroundColor = 'red';
  • inputElement.backgroundColor = 'red';
  • inputElement.style.backgroundColor = '#0000';
  • inputElement.backgroundColor = '#0000';

     举报   纠错  
 
切换
1 个答案

#0000 是不正确的写法,至少要为六位,应该是#FF0000 A写法是正确的,有两种写法:

document.getElementById("input").style.backgroundColor =

"red";      inputElement.style.backgroundColor = "#FF0000";

 
切换
撰写答案