Jump to content

background music


thibo1025
 Share

Recommended Posts

I have a dropdown form using java to have a sound on the page and 1 want to make it compatible with FF my script is this

<html> <head><title>title</title><script LANGUAGE="JavaScript"><!-- Begin  songNum = new Array();  songNum[0] = "#";  songNum[1] = "song_1.mp3";  songNum[2] = "song_2.mp3";var music = null;var track = 0;var ver = navigator.appName;function audioCheck(plugName) {for (var i = 0; i < navigator.plugins.length; i++) {if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {for (var j = 0; j < navigator.plugins[i].length; j++) {if (navigator.plugins[i][j].enabledPlugin) {return true;   }}return false;   }}return false;}function chooseSong(s) { // ietrack = s.options[s.selectedIndex].value; if (ver == "Microsoft Internet Explorer") {document.all.music.src = songNum[track]; } else {songPlay('play');   }}function songPlay(cmd) { // netscapeif (audioCheck("LiveAudio")) {if (cmd == 'play') {document.musicSource.play(false, songNum[track]);   }} else {alert("Sorry this option is only compatible with internet Explorer");   }}//  End -->  </script></head><body><script language="JavaScript"><!-- Beginvar ver = navigator.appName;if (ver == "Microsoft Internet Explorer") {document.write('<bgsound src="#" ID=music loop="1" AUTOSTART=true>');} else {document.write('<embed type="audio/midi" src="#" AUTOSTART=true hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');}// End --></script>  <form name=choose>  <select size=1 name=track onChange="chooseSong(this);">  <option value="0">Choose your song</option>  <option value="1">Song_1</option>  <option value="2">Song_2</option>  </select></form></body></html>

tell me how I can make it compatible with FF.Or is there an easier way to do this? I mean more efficent and with less code.

Link to comment
Share on other sites

  • 2 weeks later...

actually I need to know the way of doing it in FF or to hide it in FF so that the people using FF do not see what dose not work on FF

Link to comment
Share on other sites

actually I need to know the way of doing it in FF or to hide it in FF so that the people using FF do not see what dose not work on FF

To hide it search google for a javascript browser detection script thenif (browser=="Internet Explorer"){ code here}else{ alert("you are not using ie")} :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...