Help with Javascript + embed tag.

Discussion in 'Web Design and Development' started by deputy_doofy, Dec 25, 2006.

  1. deputy_doofy macrumors 65816


    Sep 11, 2002
    Ok, here's the deal. I made a new version of Scriptris, a javascript Tetris clone. I tried adding music by putting a drop-down menu in and letting the user select the tune.
    It works in FireFox (Mac) and Safari.

    It does NOT work in IE 7.x, nor FireFox (Win).
    In IE7, if I change the song, it simply plays the new song over the previous one, and I can get the same tunes all playing simultaneously, which results in an ugly mess. As you can guess, the off option doesn't work at all.
    In FF (Win), I get a message saying that it is missing a plug-in and never plays anything. It can't find any plug-ins automatically so I'm not sure what's needed. It already has QT 7.1.3 installed. What more do I need to get FF (Win) to play a quicktime sound?

    You can test it here...

    The function that creates and removes the embed tag is:
    function playTune(tune)
    // tune variable is sent from a select tag.
    // Create url based on tune selected.
    var url="./music/tune"+tune.value+".mp3";
    // Create reference pointer to embed tag.
    var tetrisTune=document.getElementById("tetris_tune");
    // Security check in case no embed tag exists.
    if (tetrisTune==null && tune.value=="0") return;
    // As long as tetrisTune reference exists...
    if (tetrisTune!=null)
    // Stop existing tune and remove embed node from document.
    // Create brand new embed node and set attributes for that tag.
    }// end playTune
  2. deputy_doofy thread starter macrumors 65816


    Sep 11, 2002
    Well, one problem fixed. By adding a type="video/quicktime" attribute/value, it now works in Windows FireFox.
    IE is still goofy, with it overlapping tunes. Well, at least the game works. :D

Share This Page