Go Back   CodingForums.com > :: Client side development > HTML & CSS

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 11-26-2002, 08:14 AM   PM User | #1
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
Text over button

I'm using both codes below for buttons but have run out of ideas for putting text over them for lables. Any ideas? Thanks

<button style="font:bold italic 12 tahoma;color:white;width:91;height:28;border:none;cursor:hand;background-image:url(redblue.gif);"><img src="redblue.gif"></button>
<br>
<br>
<img src="redblue.gif" onMouseDown='this.src="redblue_d.gif"' onMouseUp='this.src="redblue.gif"' style="width:91;height:28;border:none;cursor:hand;">
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">
zoobie is offline   Reply With Quote
Old 11-26-2002, 02:10 PM   PM User | #2
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
im unsure as to exactly what you mean...
whats the problem when you do that? you just want text over those pictures? i think in the <button> tag the value of text goes in between the <button>text</button> tag.
cg9com is offline   Reply With Quote
Old 11-26-2002, 08:07 PM   PM User | #3
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
I'm trying to use the same image for several buttons with different text on top of them for quick loading. Problem is, when I use your method of <button><img src=but.gif>text</button> or vice versa, the text goes outside of the image. I've run out of ideas I'm afraid. I'd prefer to use the top code as the whole button goes up and down...but read where this isn't widely supported. I'll take anything at this point. Thanks
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">
zoobie is offline   Reply With Quote
Old 11-26-2002, 08:44 PM   PM User | #4
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
read this:

http://codingforums.com/showthread.p...seover+buttons

does that help any? or do you want it all inline?
you can just use what i posted there, and then add text in bitween the <button></button> tag.


EX:
<button class=button
onmouseover="this.className='buttonOverClass';"
onmouseout="this.className='button';">text</button>
cg9com is offline   Reply With Quote
Old 11-26-2002, 09:41 PM   PM User | #5
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
Ahh...That className adding style to the js is sweet. I've just used the <input type="button" value="Button" because I've read where <button> is not totally supported yet. The only thing I've noticed is when adding cursor:hand; to the js style, onmousedown shows the pointer. Thanks again
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">
zoobie is offline   Reply With Quote
Old 11-27-2002, 12:05 AM   PM User | #6
cg9com
Senior Coder

 
Join Date: Jul 2002
Posts: 1,628
Thanks: 0
Thanked 0 Times in 0 Posts
cg9com is an unknown quantity at this point
yep no problem, i dont and wouldnt use the <button> tag.

good luck

Quote:
The only thing I've noticed is when adding cursor:hand; to the js style, onmousedown shows the pointer.
you can just customize each class, no problem.
cg9com is offline   Reply With Quote
Old 11-27-2002, 01:30 AM   PM User | #7
tempest1
New Coder

 
Join Date: Nov 2002
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
tempest1 is an unknown quantity at this point
Ok i found your problem

try using these attributs

onclick="this.src='image2.jpg'";
onmouseout="this.src='image1.jpg'";

it doesnt get the full feel of a button, because i cant think of the attribut that works when the mouses click is released. If you do know this, you can just use that in replace of onmouseout.

Last edited by tempest1; 11-27-2002 at 02:56 AM..
tempest1 is offline   Reply With Quote
Old 11-27-2002, 03:04 AM   PM User | #8
zoobie
Senior Coder

 
Join Date: Jun 2002
Location: ColoRockyz
Posts: 1,642
Thanks: 1
Thanked 0 Times in 0 Posts
zoobie has a little shameless behaviour in the past
I've already customized each class with cursor:hand but when I click on the button, the onmousedown still shows the pointer.

<style type="text/css">
.button {
width:91;
height:28;
background-color:transparent;
background-image:url(redblue.gif);
color:white;
font:bold italic 17 tahoma;
border:none;
cursor:hand;
}

.button_dn {
width:91;
height:28;
background-color:transparent;
background-image:url(redblue_d.gif);
color:white;
font:bold italic 17 tahoma;
border:none;
cursor:hand;
}
</style>

<input type="button" onfocus="this.blur();" value="ZOOBIE" class="button"
onMouseDown='this.className="button_dn"'
onMouseUp='this.className="button"'>

Maybe it's a result of using this type of styling with this.className.

Using the <input type="button"> rather than the <img src=blah.gif> looks more like a button because when you click on it, the text actually moves up and down, too.

However, if I were to use the onclick="this.src='image2.jpg'"; just how am I supposed to include the action of the button itself if onClick has already been used?

Thanks
__________________
Zoobie or not Zoobie...That is the problem.
<body onUnload="flush( ! )">

Last edited by zoobie; 11-27-2002 at 03:17 AM..
zoobie is offline   Reply With Quote
Old 11-27-2002, 05:47 AM   PM User | #9
chrismiceli
Regular Coder

 
Join Date: Sep 2002
Location: Louisiana
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
chrismiceli is an unknown quantity at this point
why do you have this.className? why not just this.class="button" ??
chrismiceli is offline   Reply With Quote
Reply

Bookmarks

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 04:02 PM.


Advertisement
Log in to turn off these ads.