Solved

onClick event for IMG

Posted on 2003-11-11
2
1,950 Views
Last Modified: 2008-03-06
Hi,
I wrote a simple function (javascript) and am trying to call it
from an Img event onClick, but it isnt working,
(I'm using windows98)
any idea why?
this is the HTML code
<img src="/pics/btnAddToCart.gif" border="0"  align="absbottom" onClick="buy()" > 

thanx
0
Comment
Question by:zolpo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 100 total points
ID: 9722002
where? Not IE? IE supports the onClick.
in other browsers you may need onKeyUp

ALternatively you might have a problem in function buy()

I would in all cases use

<a href="#"
onClick="buy(); return false"><img src="/pics/btnAddToCart.gif" border="0"  align="absbottom"> </a>
0
 
LVL 1

Author Comment

by:zolpo
ID: 9722119
thanx a lot!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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)
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…

730 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