Go Back   CodingForums.com > :: Client side development > Graphics and Multimedia discussions

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-21-2010, 08:26 AM   PM User | #1
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
will this html display a button with images?

Hey i have this html for my website. I just used button.gif, buttonover.gif, etc. for examples. I want to make a button with images that when gone over with mouse and different image displays and when clicked another image.

<a href="http//www.mysite.html"><img ="button.gif" onclick="buttonover.gif" onmouseover="buttonclick.gif" height="36" width="100"></a>


thanks
Repatilian is offline   Reply With Quote
Old 07-22-2010, 03:39 AM   PM User | #2
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
Hey i have this html for my website. I just used button.gif, buttonover.gif, etc. for examples. I want to make a button with images that when gone over with mouse and different image displays and when clicked another image.

<a href="http//www.mysite.html"><img ="button.gif" onclick="buttonover.gif" onmouseover="buttonclick.gif" height="36" width="100"></a>


thanks
i made a mistake on the onclick="buttonover.gif" part. I meant to say onclick="buttonclick.gif". That's for the onmouseover too. Basically i have three images of the same button just different shades. I can make them anything and i can make them all the same size and interlaced and transparent. I need to get it to work in most browsers if possible. I need it in explorer. I also have photoshop elements 2.0. I just want a button i'll attach the images.
Attached Images
   
Repatilian is offline   Reply With Quote
Old 07-22-2010, 04:32 AM   PM User | #3
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
i made a mistake on the onclick="buttonover.gif" part. I meant to say onclick="buttonclick.gif". That's for the onmouseover too. Basically i have three images of the same button just different shades. I can make them anything and i can make them all the same size and interlaced and transparent. I need to get it to work in most browsers if possible. I need it in explorer. I also have photoshop elements 2.0. I just want a button i'll attach the images.
would this work?
<a href="http//www.example.htm"><img src="button99.png" onmouseover="overbutton.png" onclick="clickbutton.png"></a>
Repatilian is offline   Reply With Quote
Old 07-22-2010, 04:32 AM   PM User | #4
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
would this work?
<a href="http//www.example.htm"><img src="button99.png" onmouseover="overbutton.png" onclick="clickbutton.png"></a>
i tried to use .png's
didn't work
Repatilian is offline   Reply With Quote
Old 07-22-2010, 05:06 AM   PM User | #5
Candan
New Coder

 
Join Date: Jun 2010
Location: The Netherlands
Posts: 52
Thanks: 0
Thanked 6 Times in 6 Posts
Candan is an unknown quantity at this point
Your best bet would be with CSS.

HTML:
Code:
<a href="http://google.com" id="google_link"></a>
CSS:
Code:
#google_link{
width:100px;
height:36px;
background:url('images/button.gif');
display:block;
}

#google_link:hover{
background:url('images/button_hover.gif');
}
I'd say go with GIF's if you're going to add transparency, because not all browsers support PNG's transparency (IE6 and such)

Last edited by Candan; 07-22-2010 at 05:11 AM..
Candan is offline   Reply With Quote
Old 07-22-2010, 05:11 AM   PM User | #6
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Wow. Okay you are doing this all wrong. First off you don't need javascript. If you were going to use javascript you aren't doing it right. You need to use this.src however I don't recommend javascript for this.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
a.about { /* repeat the following giving each link a different class or id and changing the width and height */
	height:34px;
	background:url(button9943.gif) center;
	width:100px;
	display:block;
	outline:0;
	text-indent:-999em; /* use this to hide the text but make it show when using a screen reader */
}
a.about:hover {
	background:url(button99233over.gif) center;
}
a.about:active, a.about:focus {
	background:url(button99233push.gif) center;
}
</style>
</head>

<body>
<a href="http//www.mysite.html" class="about">About</a>
</body>
</html>
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Users who have thanked _Aerospace_Eng_ for this post:
Repatilian (07-22-2010)
Old 07-22-2010, 06:03 AM   PM User | #7
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
ok it worked almost when the mouse whent over the image it went to just a white area where the image was. Then when clicked it worked good. The link worked. I guess the only question i can think of would be should i of saved the image in corel draw as a style? I'm sure this will work though.
Repatilian is offline   Reply With Quote
Old 07-22-2010, 06:10 AM   PM User | #8
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
ok it worked almost when the mouse whent over the image it went to just a white area where the image was. Then when clicked it worked good. The link worked. I guess the only question i can think of would be should i of saved the image in corel draw as a style? I'm sure this will work though.
ok i got it to work the pixels where 36x100. one question though is there a way to get the image to reset to the first image, the one i have as button9943.gif, when someone navigates back to the page that the link originated from while they're visiting my site? Thank you. It works good. I really appreciate it.
Repatilian is offline   Reply With Quote
Old 07-22-2010, 06:15 AM   PM User | #9
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
ok i got it to work the pixels where 36x100. one question though is there a way to get the image to reset to the first image, the one i have as button9943.gif, when someone navigates back to the page that the link originated from while they're visiting my site? Thank you. It works good. I really appreciate it.
nevermind it works perfectly thank you
Repatilian is offline   Reply With Quote
Old 07-22-2010, 08:22 AM   PM User | #10
Repatilian
Regular Coder

 
Join Date: Jul 2010
Location: Arizona
Posts: 110
Thanks: 14
Thanked 0 Times in 0 Posts
Repatilian is an unknown quantity at this point
Quote:
Originally Posted by Repatilian View Post
ok i got it to work the pixels where 36x100. one question though is there a way to get the image to reset to the first image, the one i have as button9943.gif, when someone navigates back to the page that the link originated from while they're visiting my site? Thank you. It works good. I really appreciate it.
ok my only other question is can i position that anywhere on the screen?
Repatilian is offline   Reply With Quote
Old 07-22-2010, 03:38 PM   PM User | #11
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,292
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Yes just edit a.about or even better put all of your links in an unordered or ordered list and style the list.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Reply

Bookmarks

Tags
buttons, image buttons, images, mouse click, mouse over

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 PM.


Advertisement
Log in to turn off these ads.