Script compatibility with browsers

Discussion in 'HTML' started by Uli666, Dec 4, 2006.

  1. Uli666

    Uli666 Guest

    Hi all!
    I found this script that's very useful to me. The only problem is that it
    only works in IE. Can you please help me to make it compatible with others
    browsers (at lest Firefox)? I read that the problem is about the
    document.all, but I don't know how to change it.

    Thank you very much.

    Ui666


    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <bgsound src="#" loop="0" autostart="true" id="soundFile">
    <script type="text/javascript">

    function gotoNextPage(page) {

    window.location='link.html';
    }

    function playSound(sound) {

    document.all.soundFile.src="sound.wav";
    window.setTimeout("gotoNextPage('" + sound + "');",3000);
    }

    </script>
    </head>
    <body>
    <p><a href="link.html" onclick="playSound('sound'); return false;">
    Page 2</a></p>
    </body>
    </html>
     
    Uli666, Dec 4, 2006
    #1
    1. Advertisements

  2. Let me be the first to ask.... What did you find useful about it?
     
    Travis Newbury, Dec 4, 2006
    #2
    1. Advertisements

  3. Uli666

    Uli666 Guest

    It lets play a little sound when clicking on a weblink.

    Uli666
     
    Uli666, Dec 4, 2006
    #3
  4. Uli666

    cwdjrxyz Guest

    This script apppears quite old and out of date. It appears to be from
    the browser war era when IE4 and Netscape 4 were the most recent
    browsers. It likely would be better to write a new, modern script than
    to try to update this senior citizen. Even in the browser war era, this
    script would work only for IE. Problem 1: BG sound works only on IE
    browsers and a very few others. Netscape was using embed for sound back
    then. Then IE also would support embed for sound. Problem 2. The
    document.all would work only on IE and close relatives, while Netscape
    used document.layers. Now modern browsers use document.getElementById.
    Layers is now gone for modern browsers. Modern IE, Mozilla
    family(Firefox,Netscape, Mozilla, Seamonkey) and Opera all support
    getElementById. IE6 will also still support document.all as will Opera,
    at least for some things. Also using a .wav is fine if you only use a
    very brief sound. However a .wma, .rm, and several other compressed
    audio formats have much less file size than a .wav, if your sound is
    longer - say a short song.
     
    cwdjrxyz, Dec 4, 2006
    #4
  5. Uli666

    Uli666 Guest

    Thanks for your answer.
    Yes, you are right. I also noticed that this scrip it's quite old. I agree
    that would be better to write a new one, but I'm don't know JavaScrip enough
    to do it. Could you help me in writing a new script?
    I've managed to change the document.all with getElementById, but still
    doesn't work on Firefox because of the bgsound (I guess).
    The wav sound is very brief (less than 3 seconds) and it's just 29KB.

    Thanks for helping.

    Uli666
     
    Uli666, Dec 4, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.