0

I'm a newbie trying to update my old FrontPage 98 rendered web sites and bring them up to date. I've gone through some self-help books and web tutorials and gained enough confidence to buy Expressions4 and started the learning curve, only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.

Any suggestions? I know this can be done with a Java Script, but have even less knowledge of javascripts than CSS. Am I doomed?

2
Contributors
3
Replies
5
Views
6 Years
Discussion Span
Last Post by hielo
0

only to find the CSS "hover" is NOT available in IE8. I've found the hover to be very useful in calling attention to links by changing their color.

Are you sure about that? The code below works fine for me. If anything, the lack of support would be in elements that are NOT links. For example, div:hover is not supported(AFAIK), but links have always been supported (at least since IE6).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<style type="text/css">
<!--
a:hover{background-color:yellow;color:red;}
-->
</style>

</head>
<body>
<a href="#">Hello</a>
</body>
</html>

As for javascript you can use the onmouseover and onmouseout attributes:

<div onmouseover="highlight(this)" onmouseout="highlight(this)">world</div>
<script language="JavaScript" type="text/javascript">
<!--
function highlight(e)
{
  if( e.style.backgroundColor=='yellow')
  {
  	e.style.backgroundColor='white';
	e.style.color='black';
  }
  else
  {
  	e.style.backgroundColor='yellow';
	e.style.color='red';
  }
}
//-->
</script>
0

Thanks so much! It does work now. I'm wondering if there might be a bug in Expression4. When I entered the code via that editor I got the error message - not that the syntax was wrong, but that the hover element was not supported by IE8 "in the current schema". I have much to learn, not the least of which is what the editor means by "schema".

In any case, the hover works now. I tried entering it thru Notepad and Notepad++.

Incidentally, I was ready to give up the fight until I got this timely response. I feel much less alone now, and am anxious to continue, hoping my questions back to this forum don't sound too stupid.

Thanks to hielo for this help, and to Dani for this fine resource.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.