Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Image change on mouse over
Old 08-03-2010, 04:02 AM Image change on mouse over
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
howdy

i've got a question regarding javascript and how to make an image change when i roll over it the current code is

Code:
 
<a href="../html/homepage.html"> <img src="../images/coffeebeans.jpg" alt="Coffee Shop Header" 
                     height="100" width="960" /></a>
and i want it to be when the mouse rolls over the picture it changes to another image but is still a link

thanks for any help
__________________

Please login or register to view this content. Registration is FREE
NickH is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-03-2010, 06:20 AM Re: Image change on mouse over
phpdasan's Avatar
Experienced Talker

Posts: 37
Name: Karthick B
Trades: 0
<script>
function rollOver(obj,img)
{
obj.src = img;
return false;
}
</script>

<a href="../html/homepage.html">
<img src="../images/coffeebeans.jpg" alt="Coffee Shop Header" height="100" width="960" onmouseover="rollOver(this,'a.jpg')" />
</a>

Hope this helps..
__________________
There is no secret ingredient.
phpdasan is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 07:38 AM Re: Image change on mouse over
NickH's Avatar
Extreme Talker

Posts: 155
Trades: 0
thanks mate that does help

is there a way to do it without functions?

as that is part of the assignment
__________________

Please login or register to view this content. Registration is FREE
NickH is offline
Reply With Quote
View Public Profile
 
Old 08-03-2010, 10:48 AM Re: Image change on mouse over
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use background images and CSS with the :hover pseudo class. IE 6 won't handle it with scripting however.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-03-2010, 10:53 AM Re: Image change on mouse over
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
but if you HAVE to use js without writing a "function" which really goes against good practice it would be



Code:
img .... onmouseover="this.src='new/image/path.ext'" onmouseout="this.src='old/image/path.ext'" ... />
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-05-2010, 02:27 AM Re: Image change on mouse over
Junior Talker

Posts: 1
Name: Saurav
Trades: 0
Hello!!!!!
Thank you guys for the information!!!!It really helped me!!!!
--------------------------------------------------------------------

__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ronty2010 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Image change on mouse over
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23857 seconds with 12 queries