javascript - Disabling an element when in IE -


i'm making html page plays <audio> onclick on <img> tags trigger..

javascript:

function changeimage() {     element=document.getelementbyid('myimage')     if (element.src.match("play"))     {         element.src="stop.png";         document.getelementbyid('audiotag1').src="music.mp3";         document.getelementbyid('audiotag1').play();     }      else     {         element.src="play.png";         document.getelementbyid('audiotag1').src="";     } } 

img tag:
<img id="myimage" onclick="changeimage()" src="play.png" width="20" height="20" style="position:absolute;top:5px;left:5px;">

audio tag:
<audio loop id="audiotag1" src="music.mp3" preload="auto"></audio>

so, here's problem, since ie8 not support <audio> tags, want make image disappear on ie8 or not support <audio> tag. possible? should do? once use disabled='disabled' wont work.

try using conditional comments - namely condition <!--[if lte ie 8]>.

this hide image less , including ie8 (so ie7, ie6 etc):

<!--[if lte ie 8]> #myimage {    display: none;  } --> 

so whole code this:

<!--[if ie 8]>    <style>      #myimage {        display: none;      }    </style>  <![end if]--> 

Comments