Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old July 25th, 2006, 03:37 AM   #1
New Member
 

Join Date: May 2006
Location: England
Age: 28
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Allu is on a distinguished road
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; July 25th, 2006 at 03:39 AM..
Allu is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old July 25th, 2006, 01:11 PM   #2
Most Reputable Member
 

Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,307
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 ukgeoff has a spectacular aura about ukgeoff has a spectacular aura about
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:
 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.
ukgeoff is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old August 16th, 2006, 01:16 PM   #3
Highly Reputable Member
 

Join Date: Jul 2005
Location: Northampton, England
Age: 20
Posts: 505
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 bruno89 is on a distinguished road
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:
 
<style type="text/css">
a:hover
{color:#COLORHERE}
</style>
just change the colour
__________________
WebForumz Suck Balls! Its all about the web squeeze!
bruno89 is offline  
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

Bookmarks

Tags
button , animation , help


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Full Website Reviews 33 January 17th, 2008 08:39 AM
I need help with a basic button animation! uzilover Flash and ActionScript 1 September 10th, 2007 03:04 PM
making a button animation complete Toby1979 Flash and ActionScript 4 July 8th, 2007 05:14 PM
When a button refuses to behave like a button in Flash autumn_whispers2me Flash and ActionScript 2 May 24th, 2005 06:08 PM


Search Engine Optimization by vBSEO 3.2.0 RC8