I am creating a "retro" styled website. With this, I am using certain elements of a website I created back in 2000.
One of the things I had back then was a dropdown menu that would play the midi file selected, and this still works, but only in Internet Explorer.
Firefox and Chrome will not play anything at all, and I know that bgsound is an Internet Explorer specific tag, but I have not found a way to get embed to work as well.
Here is my code:
Code:
<form name="choose">
<select onChange="midiplay(this);" name="select">
<option value="#">No Music</option>
<option value="midi/1.mid">Background 1</option>
<option value="midi/2.mid">Background 2</option>
</select>
</form>
<script language="JavaScript">
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
all[0]
);
return v > 4 ? v : undef;
}());
if (ie) {
document.write('<bgsound src="#" id="midijuke" loop="infinite" autostart="true" />');
function midiplay(what) {
document.getElementsByTagName("*").midijuke.src = what.options[what.selectedIndex].value;
}
}
if (!ie) {
document.write('<embed src="#" id="midijuke" loop="999" height="0" width="0" autostart="true" />');
function midiplay(what) {
document.getElementsByTagName("*").midijuke.src = what.options[what.selectedIndex].value;
}
}
</script>
It acts like the embed code is not getting updated with the correct src.