Button animation help!!

This is a discussion on "Button animation help!!" within the JavaScript Forum section. This forum, and the thread "Button animation help!! are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jul 25th, 2006, 07:37
New Member
Join Date: May 2006
Location: England
Age: 26
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Button animation help!!

Hey

I've got a web page that contains links. I've found a script I can use to make the links change color when the mouse is over.

The page is:
www.laasanen.net/alina/paasivu.html

One of the links contain script which is the red one. As you can see it turns grey when the mouse is over it.

The script I'm using is:

<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.b1.src ="b_blue.gif"
}
function mouseOut()
{
document.b1.src ="b_pink.gif"
}
</script>
</head>

<body>

<a href="http://www.w3schools.com" target="_blank"
onmouseover="mouseOver()"
onmouseout="mouseOut()">
<img border="0" alt="Visit W3Schools!" src="b_pink.gif" name="b1" width="26" height="26" /></a>

</body>
</html>

I'm having trouble making using this code at least twice on the same page. How is this done? The thing that happens for me is that the next link I make does not change color when the mouse is over it but the first link I made, which is now seen on the web page, changes color, even though the mouse is over the other link. I hope this made sense at all. I really need help. I guess the question is that how do I use this script on several links o the same page??
-Al

Last edited by Allu; Jul 25th, 2006 at 07:39.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jul 25th, 2006, 17:11
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Button animation help!!

From the code you have shown, the relationship between the link and the script is the bit I have highlighted.
Code: Select all
 function mouseOver()
{
document.b1.src ="b_blue.gif"
}

<a href="http://www.w3schools.com" target="_blank"
onmouseover="mouseOver()"
onmouseout="mouseOut()">
<img border="0" alt="Visit W3Schools!" src="b_pink.gif" name="b1" width="26" height="26" /></a>
So that you can use the same JavaScript with each link, this has to be unique to the link.

Your function calls from within each link need to pass a variable that uniquely identifies that link so the script knows which one to operate on.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 16th, 2006, 17:16
Highly Reputable Member
Join Date: Jul 2005
Location: Northampton, England
Age: 19
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Button animation help!!

iv used something like this befor but it was to blure thelinks not change the color try this code anyware on your site and it will work for all you links
Code: Select all
 
<style type="text/css">
a:hover
{color:#COLORHERE}
</style>
just change the colour
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
button, animation, help

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
etoxin>> Funky Flash site some really funky interactive animation. Animation to play etoxin Free Web Site Critique 33 Jan 17th, 2008 12:39
I need help with a basic button animation! uzilover Flash & Multimedia Forum 1 Sep 10th, 2007 19:04
making a button animation complete Toby1979 Flash & Multimedia Forum 4 Jul 8th, 2007 21:14
When a button refuses to behave like a button in Flash autumn_whispers2me Flash & Multimedia Forum 2 May 24th, 2005 22:08


All times are GMT. The time now is 23:29.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42