View Full Version : Make Image Clickable

10-18-2005, 09:21 AM
Hi all,

How do i make an image clickable ,like a button?
I have this code:

<img src="abc.gif" onClick=" ... "> how do i use the onClick event? Say i have a button labelled alphabet 'a' and when i click on it,i want the 'a' to appear in the textbox.

my main concern is how to i get the image to be clickable?

thanks .. !

10-18-2005, 03:33 PM
<a href = "#" onclick = "doStuff()"><img src = "yourImage.jpg"></a>
<img src = "yourImage.jpg" style = "cursor:hand;" onclick = "doStuff()">

06-27-2014, 05:18 PM
I dont understand the "dostuff()" I want to make an image to go to a website.so what do I put in the "dostuff() I just dont understand this

06-28-2014, 05:31 PM
to add characters to a div:
function AddChar(Char){

<img src="a.gif" onclick="AddChar('a');">
<img src="b.gif" onclick="AddChar('b');">
<img src="c.gif" onclick="AddChar('c');">
<div id="MyTextBox"></div>

or to show images

function ShowImage(Picture){

<img src="thumb_Mother.jpg" onclick="ShowImage('Mother.jpg');">
<img src="thumb_Mother.jpg" onclick="ShowImage('Father.jpg');">
<img src="thumb_House.jpg" onclick="ShowImage('House.jpg');">
<img id="MyPicture" src="blank.jpg">

or as links (probably what you want)

function Goto(Location){

<img src="Page1.jpg" onclick="Goto('Page1.html');">
<img src="Page2.jpg" onclick="Goto('Page2.html');">
<img src="Page3.jpg" onclick="Goto('Page3.html');">

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum