Ciao a tutti, sto praticamente impazzendo!
Ho questi 3 codici identici ma quello con i valori in esadecimale non funziona ne in IE10 ne in Chrome!
Qualcuno può aiutarmi a capire il perché? :fonzie:
1) Funziona sia con IE10 che con Chrome
2) Funziona sia con IE10 che con Chrome
3) NON FUNZIONA ne con IE10 ne con Chrome
Dove sbaglio?
Ho questi 3 codici identici ma quello con i valori in esadecimale non funziona ne in IE10 ne in Chrome!
Qualcuno può aiutarmi a capire il perché? :fonzie:
1) Funziona sia con IE10 che con Chrome
Codice:
<html>
<head>
<script>
function cambia(){
if(document.getElementById("testo").style.color == "black"){
document.getElementById("testo").style.color = "red";
}
else{
document.getElementById("testo").style.color = "black";
}
}
setInterval("cambia()",1000);
</script>
</head>
<body>
<p id="testo"> ciao </p>
</body>
</html>
2) Funziona sia con IE10 che con Chrome
Codice:
<html>
<head>
<script>
function cambia(){
if(document.getElementById("testo").style.color == "rgb(0, 0, 0)"){
document.getElementById("testo").style.color = "rgb(256, 0, 0)";
}
else{
document.getElementById("testo").style.color = "rgb(0, 0, 0)";
}
}
setInterval("cambia()",1000);
</script>
</head>
<body>
<p id="testo"> ciao </p>
</body>
</html>
3) NON FUNZIONA ne con IE10 ne con Chrome
Codice:
<html>
<head>
<script>
function cambia(){
if(document.getElementById("testo").style.color == "#000000"){
document.getElementById("testo").style.color = "#FF0000";
}
else{
document.getElementById("testo").style.color = "#000000";
}
}
setInterval("cambia()",1000);
</script>
</head>
<body>
<p id="testo"> ciao </p>
</body>
</html>
Dove sbaglio?