下列js可以让一个input的背景颜色变成红色的是? inputElement.style.backgroundColor = 'red'; inputElement.backgroundColor = 'red'; inputElement.style.backgroundColor = '#0000'; inputElement.backgroundColor = '#0000';
#0000 是不正确的写法,至少要为六位,应该是#FF0000 A写法是正确的,有两种写法:
document.getElementById("input").style.backgroundColor =
"red"; inputElement.style.backgroundColor = "#FF0000";