Javascript 设置CSS易用性,而不是易用性

Javascript 设置CSS易用性,而不是易用性,javascript,css,Javascript,Css,使用CSS转换设置ID的文本颜色无效。它只是将其更改为红色,但不会使其轻松 document.getElementById('colourword').innerHTML = "<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5

使用CSS转换设置ID的文本颜色无效。它只是将其更改为红色,但不会使其轻松

document.getElementById('colourword').innerHTML =
"<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5s;'>X</span>";

var flash = document.getElementById('flash');
flash.style.color = "#dd0000";
document.getElementById('colorWord').innerHTML=
“X”;
var flash=document.getElementById('flash');
flash.style.color=“#dd0000”;
如果我在控制台中键入document.getElementById('flash').color=“000”然后它将褪色为黑色


有什么想法吗?

这就像是颜色的瞬间变化,它不知道该从何处改变颜色

这对我很有用:

document.body.innerHTML =
"<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5s;'>X</span>";

setTimeout(function() {
    var flash = document.getElementById('flash');
    flash.style.color = "#dd0000";
},0);
document.body.innerHTML=
“X”;
setTimeout(函数(){
var flash=document.getElementById('flash');
flash.style.color=“#dd0000”;
},0);

这就像是颜色的瞬间变化,它不知道从何处改变颜色

这对我很有用:

document.body.innerHTML =
"<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5s;'>X</span>";

setTimeout(function() {
    var flash = document.getElementById('flash');
    flash.style.color = "#dd0000";
},0);
document.body.innerHTML=
“X”;
setTimeout(函数(){
var flash=document.getElementById('flash');
flash.style.color=“#dd0000”;
},0);

这就像是颜色的瞬间变化,它不知道从何处改变颜色

这对我很有用:

document.body.innerHTML =
"<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5s;'>X</span>";

setTimeout(function() {
    var flash = document.getElementById('flash');
    flash.style.color = "#dd0000";
},0);
document.body.innerHTML=
“X”;
setTimeout(函数(){
var flash=document.getElementById('flash');
flash.style.color=“#dd0000”;
},0);

这就像是颜色的瞬间变化,它不知道从何处改变颜色

这对我很有用:

document.body.innerHTML =
"<span id='flash' style='color: #000; transition: color 0.5s ease-in 0.5s; -moz-transition: color 0.5s ease-in 0.5s; -webkit-transition: color 0.5s ease-in 0.5s;'>X</span>";

setTimeout(function() {
    var flash = document.getElementById('flash');
    flash.style.color = "#dd0000";
},0);
document.body.innerHTML=
“X”;
setTimeout(函数(){
var flash=document.getElementById('flash');
flash.style.color=“#dd0000”;
},0);