Solved

onclick animation...

Posted on 1997-12-11
3
917 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

705 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

15 Experts available now in Live!

Get 1:1 Help Now