Results 1 to 1 of 1

Thread: body bg image change + div text color changer

  1. #1
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default body bg image change + div text color changer

    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

    HTML Code:
    <!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
    Last edited by angrymasteryoda; 04-19-2011 at 10:11 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •