| View previous topic :: View next topic |
| Author |
Message |
mel1
Joined: 17 Jun 2008 Posts: 6
|
Posted: Thu Jun 19, 2008 9:17 am Post subject: Images as buttons |
|
|
Can anyone tell me how to use an image instead of a button to display an alert message. I.e. how what do I put in the input type in place of button and what about the value?
function saySomething(message){
alert(message)
}
<form action = "#"
<input type="button" value="Welcome"
onclick="saySomething('Welcome to my page')"/>
</form>
Any help appreciated. |
|
| Back to top |
|
 |
|
|
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 627 Location: Cebu City Philippines
|
Posted: Thu Jun 19, 2008 9:22 am Post subject: Re: Images as buttons |
|
|
The same thing applied, use an inline event handler, in your case onclick.
| Code: |
<img src="myimage.jpg" onclick="saysSomething('Welcome to my page')" alt="this is my image"/>
|
Hope it helps. |
|
| Back to top |
|
 |
|