My javascript doesn't work on IE. What should I change?
Posted
by
klm
on Stack Overflow
See other posts from Stack Overflow
or by klm
Published on 2014-05-27T15:02:28Z
Indexed on
2014/05/27
15:25 UTC
Read the original article
Hit count: 187
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;
}
};
© Stack Overflow or respective owner