In my javascript class at college, I have to find out why this piece of code
does not run in IE6.
I can't seem to figure out why.
If anyone knows, that would be great
cheers,
Alex.
Code below
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Exercise 4</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
.borders {
border: 1px solid red;
width: 150px;
}
.li_borders {
background: yellow;
border: 1px solid blue;
color: red;
}
.li2_borders {
background: blue;
color: white;
}
#ul2 {
xwidth: 150px;
}
#ul2 li {
border-color: silver;
border-style: solid;
border-width: 1px 1px 0px 1px;
display: inline;
font-weight:bold;
margin: 0;
padding: 0 4px;
}
</style>
<script type="text/javascript">
window.onload = init;
function init()
{
var liArr = new Array();
var idx;
//--- process first UL block
var id = document.getElementById("ul1");
id.addEventListener("mouseover", ul1on, false);
id.addEventListener("mouseout", ul1off, false);
liArr = id.getElementsByTagName("li");
for(idx=0; idx<liArr.length; idx++ ) {
liArr[idx].addEventListener("click", li_s, false);
liArr[idx].addEventListener("mouseover", li_on, false);
liArr[idx].addEventListener("mouseout", li_off, false);
}
//--- process second UL block
id = document.getElementById("ul2");
liArr = id.getElementsByTagName("li");
for(idx=0; idx<liArr.length; idx++ ) {
liArr[idx].addEventListener("click", li_s, false);
liArr[idx].addEventListener("mouseover", li2_on, false);
liArr[idx].addEventListener("mouseout", li2_off, false);
}
}
function ul1on() { document.getElementById("ul1").className="borders";}
function ul1off(){ document.getElementById("ul1").className="";}
function li_s() { alert(this.innerHTML); }
function li_on() { document.getElementById(this.id).className="li_borders";}
function li_off(){ document.getElementById(this.id).className="";}
function li2_on() { document.getElementById(this.id).className="li2_borders";}
function li2_off(){ document.getElementById(this.id).className="";}
</script>
</head>
<body>
<p>This doesn't work in Internet Explorer 6. Why and whats the solution?</p>
<ul id="ul1">
<li id="li11">item 1</li>
<li id="li12">item 2</li>
<li id="li13">item 3 </li>
</ul>
<ul id="ul2">
<li id="li21">item 1</li>
<li id="li22">item 2</li>
<li id="li23">item 3 </li>
</ul>
</body>
</html>
_________________________________________________________________
What are you waiting for? Join Lavalife FREE
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D30288&_t=764581033&_r=email_taglines_Join_free_OCT07&_m=EXT
*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************