This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > February 2004 > hover





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author hover
domeceo

2004-02-17, 2:55 pm

I'm new to CSS. I have seen hover used with anchor elements to change the text color but can it be used with any other elements? Are there any other simple alternate methods of changing text color without the use of images (like with onMouseover/onMouseout)?
David Dorward

2004-02-17, 4:57 pm

domeceo wrote:
> I'm new to CSS. I have seen hover used with anchor elements to change
> the text color but can it be used with any other elements?


Yes, but it doesn't work in IE.

> Are there any other simple alternate methods of changing text color
> without the use of images (like with onMouseover/onMouseout)?


You can access CSS properties via objRef.style.propertyName (converting
two-part properties to camelCase), or change the class wtih
objRef.className.

> Posted via http://www.forum4designers.com


- Ugly and large sig
- non-standard sig seperator
- adverts on the pages

Try either a less evil Web-Usenet gateway: http://groups.google.com/
Or get a real NNTP account.

--
David Dorward <http://dorward.me.uk/>
fenian

2004-02-17, 7:29 pm

Maybe stick it in a table, and give the table cell an id, and then have
a mouseover on the table cell change the bgcolor. Example follows. Question
to throw out there - is getElementById() an IE only thing? I have to admit,
I'm pretty green with the Javascript, and have only had call to write for IE
so far, and so haven't concerned myself too much with cross browser stuff.

<script>

function chBgcolor() {
document.getElementById("link1").bgColor = "FFFFFF";
return true;
}

</script>
[html]
<tr>
<td id="link1" onmouseover="chBgcolor();"><a href="link">link
text</a></td>
</tr>


"domeceo" <domeceo.11sf8p@mail.forum4designers.com> wrote in message
news:domeceo.11sf8p@mail.forum4designers.com...
>
> I'm new to CSS. I have seen hover used with anchor elements to change
> the text color but can it be used with any other elements? Are there
> any other simple alternate methods of changing text color without the
> use of images (like with onMouseover/onMouseout)?
>
>
> domeceo
> ------------------------------------------------------------------------
> Posted via http://www.forum4designers.com
> ------------------------------------------------------------------------
> View this thread: http://www.forum4designers.com/message46697.html
>



Steve Pugh

2004-02-17, 7:29 pm

"fenian" <fenian@start.ca> wrote:
>"domeceo" <domeceo.11sf8p@mail.forum4designers.com> wrote in message
>news:domeceo.11sf8p@mail.forum4designers.com...

Top posting fixed, please don't.
[color=blue]
> Maybe stick it in a table, and give the table cell an id, and then have
>a mouseover on the table cell change the bgcolor.


Why does it need to be in a table?

Using .style.backgroundColor rather than .bgcolor it will work for any
element.

>Question
>to throw out there - is getElementById() an IE only thing?


No. It's part of the W3C DOM and is supported by IE5+, Gecko, Opera
and others. The IE only 'equivalent' is document.all

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
newsgroup user

2004-02-18, 4:28 am

http://www.xs4all.nl/~peterned/csshover.html

Trythis...

StevePughwrote:
>"fenian"<fenian@start.ca>wrote:
>
>
>
>Toppostingfixed,pleasedon't.
>
>
>
>
>Whydoesitneedtobeinatable?
>
>Using.style.backgroundColorratherthan.bgcoloritwillworkforany
>element.
>
>
>
>
>No.It'spartoftheW3CDOMandissupportedbyIE5+,Gecko,Opera
>andothers.TheIEonly'equivalent'isdocument.all
>
> Steve
>

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews