dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: Need to hide media player for sound effect

  1. #1
    Join Date
    Aug 2012
    Posts
    3

    Need to hide media player for sound effect

    A site I am working on has javascript to control sound effects for the page transitions in iframes. Everything works fine in Firefox but IE displays a media player instead of the page content. Would someone be able to tell me what need to be added to the following script to stop this happening. Any help much appreciated.

    In Head:
    <script type="text/javascript">
    function MM_controlSound(x, _sndObj, sndFile) { //v3.0
    var i, method = "", sndObj = eval(_sndObj);
    if (sndObj != null) {
    if (navigator.appName == 'Netscape') method = "Play";
    else {
    if (window.MM_WMP == null) {
    window.MM_WMP = false;
    for(i in sndObj) if (i == "ActiveMovie") {
    window.MM_WMP = true; break;
    } }
    if (window.MM_WMP) method = "play";
    else if (sndObj.FileName) method = "run";
    } }
    if (method) eval(_sndObj+"."+method+"()");
    else window.location = sndFile;
    }
    //-->
    </script>

    In Body:

    <ul>
    <li title="slide1"><a><span class="title" onclick="MM_controlSound('play','document.CS1344499390121','../Sound effects/sliding_glass_cabinet_door_open_and_close (mp3cut.net).mp3')">HOME</span></a></li>
    <li title="slide2"><a><span class="title" onclick="MM_controlSound('play','document.CS1344499390121','../Sound effects/sliding_glass_cabinet_door_open_and_close (mp3cut.net).mp3')">CHOW GAR KUNG FU</span></a></li>
    </ul>

  2. #2
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    HTML Code:
    <!--[if IE]>
    IE Sucks, so you cannot see this content.
    <![endif]-->
    
    
    <![if !IE]>
    <ul>
    <li title="slide1"><a><span class="title" onclick="MM_controlSound('play','document.CS1344499390121','../Sound effects/sliding_glass_cabinet_door_open_and_close (mp3cut.net).mp3')">HOME</span></a></li>
    <li title="slide2"><a><span class="title" onclick="MM_controlSound('play','document.CS1344499390121','../Sound effects/sliding_glass_cabinet_door_open_and_close (mp3cut.net).mp3')">CHOW GAR KUNG FU</span></a></li>
    </ul>
    <![endif]>

    http://www.javascriptkit.com/howto/cc2.shtml

  3. #3
    Join Date
    Aug 2012
    Posts
    3

    Thanks but not working

    Thanks Donatello. Unfortunately this removes the whole menu in IE. I just need the media player that plays the sound to be invisible and not sure how to do that. Where would I add width="0" height="0" hidden="true". Basically the user clicks a link which moves to that page using a slider script in iframes. The sound effect also plays. The trouble is in ie the pages that appear only show the media player controller which I think overlays the actual page. Hope this makes sense.

  4. #4
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    This is how a conditional works:

    HTML Code:
    <!--[if IE]>
    Put whatever you want to be visible to IE users here.
    <![endif]-->
    
    
    <![if !IE]>
    Put whatever you want to be invisible to IE users here.
    <![endif]>
    Experiment with it.
    You can also create a separate style and put it in the head. A snippet of a style sheet that just covers the IE stuff. Make sure that it is in the right order.

    HTML Code:
    <html>
    <head>
    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="myIEstyle.css" />
    <![endif]-->
    
    <![if !IE]>
    <link rel="stylesheet" type="text/css" href="myNON-IEstyle.css" />
    <![endif]>
    </head>
    <body>
    Your Page Content...
    </body>
    </html>

  5. #5
    Join Date
    Aug 2012
    Posts
    3
    Thanks for all your help Donatello.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles