Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Scheuer Toggle Sound Script II FireFox Problem

  1. #1
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Scheuer Toggle Sound Script II FireFox Problem

    Hi:

    I have been using the follow script for quite sometime. And just now noticed that it works well in MSIE and Chrome but in the latest Fire Fox it does play the music but the on/off switch won't work where previously it worked in all three browsers. Any ideas on how to make it work as intended in FireFox are appreciated. Thanks.

    <script type="text/javascript">
    /*Toggle Sound Script II John Davenport Scheuer
    as first seen in www.dynamicdrive.com/forums (user name:
    jscheuer1). Visit http://www.dynamicdrive.com for 100's
    of DHTML scripts. This credit must remain for legal use.
    */

    var sndEl="music/claire_de_lune.mid" //Set to name and path of your sound file
    var music_on="images/eyiplay.gif" //Set to image to display while music is on
    var music_off="images/eyistop.gif" //Set to image to display while music is off
    var active_img="images/eyispeaker.gif" //Set to image to display while image is hovered

    ///////////////Stop Editing///////////////

    var da=document.all
    var preload=[music_on, music_off, active_img]
    var preloading=new Array();
    for (var i_tem = 0; i_tem < preload.length; i_tem++){
    preloading[i_tem]=new Image();
    preloading[i_tem].src=preload[i_tem]
    }

    function textReveal(el, state){
    var text=da? da.text : document.getElementById('text')
    text.style.visibility=state=='on'? 'visible' : ''
    el.src=state=='on'? active_img : el.lowsrc
    }

    function toggleSound(el){
    var text=da? da.text : document.getElementById('text')
    if (da&&da.sound&&da.sound.src!==''){
    da.sound.src=''
    el.lowsrc=music_off
    text.innerHTML='&nbsp;Music On'
    }
    else if (document.getElementById('snd')){
    sndEl=document.getElementById('snd')
    document.getElementById('sndC').removeChild(sndEl)
    el.lowsrc=music_off
    text.innerHTML='&nbsp;Music On'
    }
    else if (da&&da.sound&&da.sound.src==''){
    da.sound.src=sndEl
    el.lowsrc=music_on
    text.innerHTML='&nbsp;Music Off'
    }
    else {
    document.getElementById('sndC').appendChild(sndEl)
    el.lowsrc=music_on
    text.innerHTML='&nbsp;Music Off'
    }
    }
    </script>

    I use the following code on the page to call it:

    <!-- Begin Toggle Sound Body Code --><font color="#c0c0c0">
    <!--[if IE]>
    <script type="text/javascript">
    document.write('<bgsound id="sound" src="'+sndEl+'" loop="-1">')
    </script>
    <![endif]-->

    <script type="text/javascript">
    if (document.getElementById&&!document.getElementById('sound')){
    document.write('<div id="sndC" style="width:0;height:0;position:absolute;top:-1000px:left:-1000px;visibility:hidden;">')
    document.write('<embed id="snd" style="width:0;height:0;position:absolute;top:-1000px:left:-1000px;visibility:hidden;" src="'+sndEl+'" autostart="true" hidden="true" loop="true">')
    document.write('<\/div>')
    }
    if ((da&&da.sound)||document.getElementById)
    document.write('<img style="cursorointer;" lowsrc="'+music_on+'" src="'+music_on+'" onmouseout="textReveal(this, \'off\')" onmouseover="textReveal(this, \'on\');" onclick="toggleSound(this);"><span id="text">&nbsp;Music Off<\/span>')
    </script>
    <!-- End Toggle Sound Body Code -->
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    I have no immediate plans to update this script. But you should try the more recent version:

    http://www.dynamicdrive.com/forums/s...9&postcount=13
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John, thanks for the quick response. The new version that you suggested took care of my FireFox problem as it now works in all the three browsers I checked. I do have a problem which is due to my ignorance. I would like to have the script start off by playing the music and then having the option to turn it off. I looked at the script but unlike the script that I was using previously could not figure out how to do this. Would you be able to suggest what to change. Thank you.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    I think that information is here:

    http://www.dynamicdrive.com/forums/s...5&postcount=18
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John:

    Thanks for all the help. Script is working as it should. Once again thanks.
    Last edited by datachem; 06-02-2010 at 06:00 PM.

  6. #6
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well the problem with the music script was resolved but now I find that it is conflicting with my Versluis HV Menu version 5.51. When viewed in MSIE I am able to see the menu but can not toggle the music while with with FireFox I do not get to see the menu and I cannot toggle the music. If I enter <body onload= "function Go(){return};"> I am then able to see the menu in FireFox but am still not able to toggle the music.
    Finally I had the following code on my main page <SCRIPT LANGUAGE="JavaScript1.2" src="http://www.codeamber.org/js/codea.js"> and that causes everything to work which is why I thought all my problems had been fixed until I viewed all the other pages. If this cannot be resolved I will most likely go with another menu since I don't believe I will be able to fing another music script. Any suggestion would be appreciated. Thank you.

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    That sounds like just an onload conflict. Replace:

    Code:
    onload=function(){toggleSound(document.images.bob);
    if(document.getElementById&&document.getElementById('sndC'))
    document.getElementById('sndC').style.display='';
    toggleSound(document.images.bob);
    document.images.bob.src = document.images.bob.lowsrc;};
    with:

    Code:
    ;(function(){
    var f = function(){toggleSound(document.images.bob);
    if(document.getElementById&&document.getElementById('sndC'))
    document.getElementById('sndC').style.display='';
    toggleSound(document.images.bob);
    document.images.bob.src = document.images.bob.lowsrc;};
    if (window.addEventListener){
    	window.addEventListener('load', f, false);
    }
    else if (window.attachEvent){
    	window.attachEvent('onload', f);
    }
    })();
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #8
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John:

    Thank you for the feedback - especially when you did it on Father's Day. That did correct my problem with MSIE as the menu appears and the I am able to toggle the music on and off. With respect to FireFox both the menu and the music on/off switch appear on the page. However, the toggle switch is not functional.

    Again thanks.

  9. #9
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,167
    Thanks
    44
    Thanked 3,240 Times in 3,201 Posts
    Blog Entries
    12

    Default

    That sounds like a layout problem - maybe. It might be that something unseen is covering the button. But it could be something else.

    You should test it with this new loading code and without the menu in Firefox. If it still doesn't work, try it without the menu and with the old onload code.

    If you want me to poke around:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #10
    Join Date
    Aug 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John:

    Sorry I wasn't clearer. InFireFox I can see both the menu and the toggle switch button. The problem is that the toggle switch is not functional. In MSIE both are working find.

    As to a url I would be glad to do so but is ther anyway that I can PM you with it or send it so as it does not appear on this board? Thanks.

    Anthony.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •