What does this javascript function do

I have taken over a website, and I can work out what most things do, but this script is on almost every page and I can't work out what its doing. I can remove it and the page seems to work fine so some advice on its function would be brilliant.

<!-- #BeginEditable "style" -->
<script type="text/javascript"><!--//--><![CDATA[//><!--
sfHover = function() {
	var sfEls = document.getElementById("nav4").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
if (window.attachEvent) window.attachEvent("onload", sfHover);
<!-- #EndEditable -->

Open in new window

LVL 15
Who is Participating?
It is used for dropdown menus.

Take a look at:

ChloesDadAuthor Commented:
We do have dropdown menus on the site, but they appear to be functioning perfectly without this code.

I have found code in out common css that sets up the hover, the article mentions that IE doesn't support this, but I am testing on IE11, Is it only earlier versions of IE that didn't support this and hence need the JavaScript code?
Chances are you are correct about the earlier versions. If the code you are looking at is years old, then it makes that even more likely, since IE has had significant changes over the past several years.
ChloesDadAuthor Commented:
Thanks, it is quite old. Either way, I can put the function into our PageHeader file which is included on every page, rather than having it directly on every page.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.