• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.

Katman Rengini Değiştirme

ByOnur58

Kayıtlı Üye
Forum Yaşı
11 Yıl 4 Ay
Mesajlar
2,114
Tepkime puanı
10
Kod:
<head>
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Antonio Lupetti | http://woork.blogspot.com/ */

function changeBg(idLayer){
 	idLayer_n=********.getElementById(idLayer);
 	if(idLayer_n.style.background==''){
 		 ********.getElementById(idLayer).style.background='#dedede';
 		 ********.getElementById('cb_text').innerHTML='Changed! Click to restore';
 	} else {
  		********.getElementById(idLayer).style.background='';
  		********.getElementById('cb_text').innerHTML='Change Background color';
 	}
}

function changeBgInput(idLayer){
 	idLayer_n=********.getElementById(idLayer);
 	idColor_txt=********.getElementById('myColor_txt').value;
 	idColor_bg=********.getElementById('myColor_bg').value;
 	idLayer_n.style.color=idColor_txt;
 	idLayer_n.style.background=idColor_bg;
}
</script>
</head>

<body>

<strong>Example 1</strong><br>
Change the background color using a fixed color in the script<br><br>
<a href="#" onClick="javascript:changeBg('myLayer')" id="cb_text">Change Background  color</a>
<div id="myLayer">Watch the background color change!</div>

<br><br>

<strong>Example 2</strong><br>
Change text and background color with user-selected colors:<br><br>
Text color:<br>
<input type="text" id="myColor_txt" name="myColor_txt" value="#FFFFFF"><br>
Background color:<br>
<input type="text" id="myColor_bg" name="myColor_bg" value="#555555"><br>
<a href="#" onClick="javascript:changeBgInput('myLayer2');">Change text and background color</a>
<div id="myLayer2">Watch the text and background colors change!</div>
</body>
 
Geri
Üst