Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-22-2004, 01:14 PM   PM User | #1
wobblehead
New Coder

 
Join Date: Dec 2004
Location: England
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
wobblehead is an unknown quantity at this point
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

wobblehead is offline   Reply With Quote
Old 12-22-2004, 03:00 PM   PM User | #2
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
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
Willy Duitt is offline   Reply With Quote
Old 12-22-2004, 03:57 PM   PM User | #3
Willy Duitt
Banned

 
Join Date: Sep 2003
Posts: 3,620
Thanks: 0
Thanked 0 Times in 0 Posts
Willy Duitt is an unknown quantity at this point
You can also look here:
http://www.webdeveloper.com/forum/sh...766#post291766

.....Willy
Willy Duitt is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:50 AM.


Advertisement
Log in to turn off these ads.