Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Images as buttons



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
mel1



Joined: 17 Jun 2008
Posts: 6

PostPosted: Thu Jun 19, 2008 9:17 am    Post subject: Images as buttons Reply with quote

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
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 627
Location: Cebu City Philippines

PostPosted: Thu Jun 19, 2008 9:22 am    Post subject: Re: Images as buttons Reply with quote

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
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap