Kodları lütfen aşağıdaki butonları kullanarak renklendirin. Örnek: <php> echo "Selam Dünya"; </php>
Yardım
karakter kaldı

zemin renkleri

<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> &nbsp;
<span id="y" onmouseover="RenkVer(this.id,'#990033')" onmouseout="RenkVer(this.id,'')">BBB</span> &nbsp;
<span id="z" onmouseover="RenkVer(this.id,'#996600')" onmouseout="RenkVer(this.id,'')">CCC</span>


<p>
<span id="x1"> aaa</span> &nbsp;
<span id="y1">bbb</span> &nbsp;
<span id="z1">ccc</span>
</p>

yukarıdaki örnek çalışıyor.
Yani büyük AAA nın üzerine gelince hem AAAnın hemde aaa nın zemin rengi aynı oluyor.
Peki aynı anda tersi de olabilir mi? Yani küçük aaa nın üzerine de gelince hem aaa nın hem AAA nın rengi aynı olsun.
+0
-0
Cevaba KatılıyorumKatılmıyorum
Cevap Yaz Yorum Yaz Arşivime Ekle Takip Et

Doğru Cevap

  • 1
    harryistal adlı üyenin fotoğrafı
    12 yıl önce yazılmış
    49 cevap - 24 soru
    
    <script type="text/javascript">
        function RenkVer(div, renk) {
            if (div.indexOf('1') == -1) {
                document.getElementById(div).style.backgroundColor = renk; document.getElementById(div + '1').style.backgroundColor = renk;
            } else { document.getElementById(div).style.backgroundColor = renk; document.getElementById(div.replace('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" onmouseover="RenkVer(this.id,'#FFFF00')" onmouseout="RenkVer(this.id,'')">aaa</span>   
    <span id="y1" onmouseover="RenkVer(this.id,'#FFFF00')" onmouseout="RenkVer(this.id,'')">bbb</span>   
    <span id="z1" onmouseover="RenkVer(this.id,'#FFFF00')" onmouseout="RenkVer(this.id,'')">ccc</span> 
    </p> 
    

Cevaplar

Hiç cevap bulunamadı.