Converting image to work as button

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
ashrafzia
Forum Commoner
Posts: 37
Joined: Wed Sep 28, 2005 12:23 pm

Converting image to work as button

Post by ashrafzia »

Can anyone help me that how to convert an image to work as button.
Actually my question involve different issues.
I am making an online examination system in which in the admin area i have images instead of buttons for good look. Lets say i have an image Student Now when the student image (which will work as button) is clicked i should be proceeded to the same page, with these different options.
Add Student
Delete Student
Edit Student
Update Student
Plz clarify me that in case of form buttons we make a hidden filed named let's say (h1) and then make its value to true and when that button is clicked, in the action of that form we provide the same file name, let's say student.php and then we have an isset() function and we check that either h1 form is submitted or other and then according to that form we write code.
So in case of images how can we handle such things.
I hope you get what i want to say
Thanx for any help in advance. :oops:
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You can make an image behave like a button using the

Code: Select all

<input type = "image" src = "path/to/image/file" name = 'blah'>
syntax. This will cause the input element to behave like a submit button.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
ashrafzia
Forum Commoner
Posts: 37
Joined: Wed Sep 28, 2005 12:23 pm

Post by ashrafzia »

pickle wrote:You can make an image behave like a button using the

Code: Select all

<input type = "image" src = "path/to/image/file" name = 'blah'>
syntax. This will cause the input element to behave like a submit button.
Fine Done it. Now how can i convert it to a rollover ?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

For a form button? You'll have to use Javascript. There are scripts & tutorials all over the internet on how to do this.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Code: Select all

<input type="button" value="Button" name="B3" style="border: 1px solid #FFFFFF; background-image: url('background_image_location.jpg')">
Change The #FFFFFF To The Background Color Of Your Page
And Change The background_image_location.jpg To The Location Of Your Image File

feyd | color and 24 pixel font isn't needed...
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

ashrafzia wrote:
pickle wrote:You can make an image behave like a button using the

Code: Select all

<input type = "image" src = "path/to/image/file" name = 'blah'>
syntax. This will cause the input element to behave like a submit button.
Fine Done it. Now how can i convert it to a rollover ?
You can use the :hover psuedo class, but it will not work in IE6 and below.
Post Reply