Doğru Cevap
-
<script type="text/javascript"> function RenkVer(div, renk) { document.getElementById(div).style.backgroundColor = renk;document.getElementById(div + '1').style.backgroundColor = renk; } </script>
<span id="x" onmouseover="RenkVer(this.id,'#FFFF00')" onmouseout="RenkVer(this.id,'')">SARI</span> <span id="x1">SARI</span>
font face etiketi nie kullandın anlamadım ama span kullanabilrsin veya div veya başka bir etiket hepsinde calısabilrsin aynı şekilde istediğin kadar yeni span ekle hepsini tek javascript fonksionuyla yapabilrsin üsteki kodla-
imeilim
her iki arkadaşa da emekleri için çok teşekkürler Allah razı olsun...10 yıl önce yazılmış -
imeilim
<script type="text/javascript">
function RenkVer(div, renk) { document.getElementById(div).style.backgroundColor = renk;document.getElementById(div + '1').style.backgroundColor = renk; }
</script>
<span id="x" onmouseover="RenkVer(this.id,'#FFFF00')" onmouseout="RenkVer(this.id,'')">AAA</span>
<span id="y" onmouseover="RenkVer(this.id,'#990033')" onmouseout="RenkVer(this.id,'')">BBB</span>
<span id="z" onmouseover="RenkVer(this.id,'#996600')" onmouseout="RenkVer(this.id,'')">CCC</span>
<p>
<span id="x1"> aaa</span>
<span id="y1">bbb</span>
<span id="z1">ccc</span>
</p>
hocam yukarıdaki gibi yaptım çalışıyor.
Yani büyük AAA nın üzerine gidnce hem AAAnın hemde aaa nın zemin rengi aynı oluyor.
Peki aynı anda tersi de olabilir mi? Yani aaa nın üzerine de gelince hem aaa nın hem AAA nın rengi aynı olsun.10 yıl önce yazılmış
-
Cevaplar
-
Çiçeği burnunda js ye giriş yaoan kişi olarak şöle bişeyler yaptım mouseout tam olmadı:
<script type="text/javascript">
function newColor(color)
{
if (color=='#FFFF00')
{
document.getElementById('x').style.backgroundColor=color;
document.getElementById('y').style.backgroundColor='';
document.getElementById('z').style.backgroundColor='';
}
if (color=='#00008B')
{
document.getElementById('x').style.backgroundColor='';
document.getElementById('y').style.backgroundColor=color;
document.getElementById('z').style.backgroundColor='';
}
if (color=='#FFA500')
{
document.getElementById('x').style.backgroundColor='';
document.getElementById('y').style.backgroundColor='';
document.getElementById('z').style.backgroundColor=color;
}
}
</script>