Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2004
    Location
    England
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Simple Rollover Button Problem - Newbie

    Hi,

    I'm new to Javascript, and I would be so grateful if anyone could help me out here. I'm trying to create a rollover button as part of a navigation bar I am going to create in due course. I just can't get the rollover to work though. The actual button appears, however when you hover the mouse over it, nothing happens. Thank you for taking time to help me, and a merry christmas & a happy new year to everybody!

    Code:
    <?xml version="1.0" encoding = "UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title> Big Dog Music News - Homepage </title>
    <link rel="stylesheet" type="text/css" href="home.css"/>
    <script language="Javascript" type="text/javascript">
    
    <!-- Hide script from old browsers
    
    if(document.images)
    {
    buttonLightPurple = new Image
    buttonDarkPurple = new Image
    
    buttonLightPurple.src = "images/homeButton.gif"
    buttonDarkPurple.src = "images/homeButtonRollover.gif" 
    }
    
    else
    {
    buttonLightPurple = ""
    buttonDarkPurple = ""
    document.button = ""
    }
    
    // End hiding script from old browsers
    
    </script>
    </head>
    
    <body>
    
    <div id="header" align="center">
    <table width=75%>
    <tr>
    <td class="dollar">
    <img src="images/dollar.gif" alt="dollar"/>
    </td>
    <td id="logo">
    <img src="images/heading.gif" alt="logo"/>
    </td>
    <td class="dollar">
    <img src="images/dollar.gif" alt="dollar"/>
    </td>
    </tr>
    </table>
    </div>
    
    <a href="index.html" 
    onmouseover="document.button.src=buttonDarkPurple.src" 
    onmouseout="document.button.src=buttonLightPurple.src"
    <img src="images/homeButton.gif" border="0" name="button" alt="button"/>
    </a>
    
    </body> 
    
    </html>
    Thanks again!

    Joe P aka Wobblehead


  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For one you never closed your opening anchor tag and by not working I assume that you can not even see the image...

    <a href="index.html"
    onmouseover="document.button.src=buttonDarkPurple.src"
    onmouseout="document.button.src=buttonLightPurple.src">

    .....Willy

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can also look here:
    http://www.webdeveloper.com/forum/sh...766#post291766

    .....Willy


  •  

    Posting Permissions

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