Hello, I'm new to javascript, and need some help, why the following code refuses to do anything.
<html>
<head>
<style type="text/css">
.btn
{
background:URL("elemer.jpg");
width:200px;
height:100px;
display:block;
}
.btn.sfhover, .btn:hover
{
background-image:none;
}
</style>
<script type="text/javascript">
sfHover = function() {
var sfEls = document.getElementById(„btn”);
sfEls.onmouseover=function() {
this.className+=” sfhover”;
sfEls.onmouseout=function() {
this.className.replace(new RegExp( „sfhover\\b”), „”);
}
}
}
If(window.attachEvent) window.attachEvent(„onload”, sfHover);
</script>
</head>
<body onLoad="sfHover">
<input type="button" class="btn" value="value"/>
</body>
</html>
I get the error "sfHover isn't defined". What am I doing wrong? The purpose of the code would be to add a :hover (here: .sfHover) css pseudo-class on the mouseover event, to work in IE.
Any clues?
Thanks in advance.