|
-
Sep 3rd, 2001, 10:19 AM
#1
Thread Starter
Fanatic Member
CSS question
hi,
ok, heres my question.
i have an "OnMouseOver" and an "OnMouseOut", and for each mouseover and mouse out, its the same sequece(change color)
can i assign it to a "function", so that itll change the color, instead of having to put the code in each section?
thanks
nabeel
-
Sep 3rd, 2001, 12:30 PM
#2
Fanatic Member
If you are only coding for IE you can use this:
<style>
a:hover { color:green; font-weight:bold; }
</style>
Again, this will only work for IE. The above style will work for all links on the page.
-
Sep 3rd, 2001, 05:34 PM
#3
Fanatic Member
Yeah, you can.
Code:
<script>
function changecolor(id, color)
{
id.style.color = color;
}
</script>
...
<span onMouseOver="changecolor(this,'red')" onMouseOut="changecolor(this,'black')">
turns red on mouseover, black on mouseout
</span>
Alcohol & calculus don't mix.
Never drink & derive.
-
Sep 4th, 2001, 02:55 PM
#4
Frenzied Member
I'm afriad you can't. 'Least I'm not finding anything in the CSS specs at W3C. I would like to do the same thing. It makes sense to me.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Sep 5th, 2001, 10:39 AM
#5
Thread Starter
Fanatic Member
well, right now im using:
Code:
<td height="29" onMouseOver="style.backgroundColor='#CCCC99'; borderColor='#000000';" onMouseOut="style.backgroundColor='#F0F0E1'; borderColor='#F0F0E1';">
and its for only a few cells, like ones in which the subject is. instead of copy and pasting that whole bit, i wanna just have it link. well if you cant do it that way then
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Sep 5th, 2001, 10:39 AM
#6
Thread Starter
Fanatic Member
well, right now im using:
Code:
<td height="29" onMouseOver="style.backgroundColor='#CCCC99'; borderColor='#000000';" onMouseOut="style.backgroundColor='#F0F0E1'; borderColor='#F0F0E1';">
and its for only a few cells, like ones in which the subject is. instead of copy and pasting that whole bit, i wanna just have it link. well if you cant do it that way then
thanks
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Sep 5th, 2001, 10:42 AM
#7
Frenzied Member
You can make functions, like Wynd suggested, you just can't put this in CSS.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|