document.getElementById(obj).style.backgroundColor = "red";
<script type="text/javascript">
<!--
function changebg(id) {
var e = document.getElementById(id);
if(e) {
e.style.backgroundColor='#ffffff';
e.style.fontcolor='#000000';
}
}
-->
</script>
onmouseout=javascript:changebg('');
<script type="text/javascript">
<!--
function changebg(id,a) {
if (a == '') {
document.getElementById(id).style.backgroundColor='';
document.getElementById(id).style.fontcolor='';
}
else {
var e = document.getElementById(id);
e.style.backgroundColor='#ffffff';
e.style.fontcolor='#000000';
}
}
-->
</script>
SuperCureuil a dit:Ya mais ce n'est pas parce que c'est du javascript que tu peux changer les noms de propriétés css :wink:
function changebg(id,a) {
if (a == '') {
document.getElementById(id).style.backgroundColor='';
document.getElementById(id).style.alinkColor='';
document.getElementById(id).style.border='0';
}
else {
var e = document.getElementById(id);
e.style.backgroundColor='#ffffff';
e.style.color='#000000';
e.style.border-left='1px solid black';
e.style.border-right='1px solid black';
}
}
<a href="" onMouseOver="changebg(this,1)">link</a>
function changebg(e,a) {
if (a == '') {
e.style.backgroundColor='';
e.style.alinkColor='';
e.style.border='0';
}
else {
e.style.backgroundColor='#ffffff';
e.style.color='#000000';
e.style.border-left='1px solid black';
e.style.border-right='1px solid black';
}
}
➡️ Offre MyRankingMetrics ⬅️
pré-audit SEO gratuit avec RM Tech (+ avis d'expert)
coaching offert aux clients (avec Olivier Duffez ou Fabien Faceries)
Voir les détails ici