PDA

View Full Version : body bg image change + div text color changer



angrymasteryoda
04-19-2011, 09:49 PM
okay i have the background image changing right. but i can't figure your out how to get the text of id head_right to change text color when the else image is being displayed. opps forgot the link. here is the link (http://exiledninja.darkbb.com/h39-error_page)


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!--credits to angrymasteryoda-->
<title>Socom Fire Team Bravo 2 Imposterer Generator</title>
<style type="text/css">
body
{
background-color:#000000;
background-image: url(http://teamtutorials.com/wp-content/uploads/2007/05/horizontal-red-repeating-background-tutorial-19.jpg)
}
#head_right
{
position:relative;
left:400px;
top:-45px
color:black;
}
</style>
</head>
<body>
<br><div id='head_left'><h1>Exiled Ninja</h1><div id='head_right'><h3>Socom Fire Team Bravo 2 Imposter Generator</h3></div><br>
<br>
<div>
<script language="javascript" type="text/javascript">
function changeDivImage()
{

imgPath = document.body.style.backgroundImage;

head = document.getElementById("head_right").style.color;

if(imgPath == "url(http://teamtutorials.com/wp-content/uploads/2007/05/horizontal-red-repeating-background-tutorial-19.jpg)" || imgPath == "")
{
document.body.style.backgroundImage = "url(http://www.interweb.in/attachments/pc-wallpapers/25220d1235656096-abstract-wallpapers-images-photos-picture-gallery-dark-abstract-wallpaper.jpg)";
}
else
{
document.body.style.backgroundImage = "url(http://teamtutorials.com/wp-content/uploads/2007/05/horizontal-red-repeating-background-tutorial-19.jpg)";
if (head == "black")
{
document.getElementById("head_right").style.color = "red";
}
}
}
</script>
<center>
<input type="button" value="Change Background Image" onclick="changeDivImage()" />
</center>
</div>
</body>
</html>
thanks for the help