My javascript doesn't work on IE. What should I change?
- by klm
I'm making simple site for my school project.
My code doesn't work on my teacher's PC (he has IE 6 or 7 - I don't remember).
I use it to change content on site (kind of menu).
html:
<ul>
<li onclick="run(1)"> ... </li>
<li onclick="run(2)"> ... </li>
<li onclick="run(3)"> ... </li>
<li onclick="run(4)"> .... </li>
<li onclick="run(5)"> .... </li>
<li onclick="run(6)"> .... </li>
</ul>
Script:
function run(x) {
///New Content:
var a =
...
var e = "<a href='xxxx'> aaaaaa</a>" //example
/////////////////////
var p = document.getElementById("content");
if(x === 1) {
p.innerHTML=a;
}
else if(x === 2) {
p.innerHTML=b;
}
else if(x === 3) {
p.innerHTML=c;
}
else if(x === 4) {
p.innerHTML=d;
}
else if(x === 5) {
p.innerHTML=e;
}
else {
p.innerHTML=f;
}
};