Solved

onclick animation...

Posted on 1997-12-11
3
929 Views
Last Modified: 2013-11-19
I know how to use rollover javascripts to make a (hyperlinked) image change state before being clicked on (onmouseover/onmouseout), but is there a way of changing state for a non-hyperlinked image? Specifically, I want a static image which animates when clicked on. The animation can be handled by using an animated GIF, I just need someone to give me the right script (some variation of onClick I would imagine, but I don't really know enough about it...).

Cheers.
Ian Westbrook
0
Comment
Question by:westbrook
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
jshamlin earned 100 total points
ID: 1276088
There's presently no method to detect an onMouseover event for a "regular" image - you can create a "fake" link to manipulate it, though:

<A HREF="javascript:doThis()"><IMG SRC="thing.gif"></A>

Note that the function doThis() will be executed onClick - if you'd like the click to do nothing, then create an "empty" function for doThis().  You may also add event handlers to the HREF to manipulate the image onMouseover, etc.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1276089
If my comment works better for you, I would like the opportunity to post this as an answer.
0
 
LVL 6

Expert Comment

by:tecbuilder
ID: 1276090
I'm sure jshamlin's answer works, but at my level of knowledge 'empty functions' means nothing... techbuilder's answer is both more elegant and works, so at the risk of offending jshamlin, I think I'd rather his answer was posted.
But thank you both for your time!

Best regards,

Ian Westbrook
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now