求助:之前的一个帖子解决了如何在关闭层的时候同时关闭播放器,
但问题在于,如果在页面上设置点击弹出层,则弹出的层显示空白,应该是说层一被显示或隐藏,他就触发那个
document.getElementById("container").removeChild(document.getElementById("ply"));
事件,所以显示空白,
不知道该怎么解决,
希望有识之士帮忙解决啊!
万分感谢!

解决方案 »

  1.   

    显示,隐藏 用display="block",“none”
      

  2.   

    隐藏层的时候触发一个方法,去执行
    document.getElementById("container").removeChild(document.getElementById("ply"));
    而显示层的时候,
    要重新把这个flash加载进来
      

  3.   

    你想要的是否是如下效果?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {
    font-size: 14px;
    color: #009933;
    }
    .STYLE2 {font-size: 18px}
    .STYLE5 {
    font-size: 24px;
    color: #00CC00;
    }
    .STYLE6 {font-size: 18}
    .STYLE7 {font-size: 16px}
    .STYLE8 {color: #0000FF}
    .STYLE9 {color: #00CC00}
    .STYLE31 { color: #00CC00;
    font-size: 18px;
    }
    #Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 279px;
    top: 14px;
    }
    -->
    </style>
    <script type="text/javascript">
    <!--function MM_CheckFlashVersion(reqVerStr,msg){
      with(navigator){
        var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
        var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
        if (!isIE || !isWin){  
          var flashVer = -1;
          if (plugins && plugins.length > 0){
            var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
            desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
            if (desc == "") flashVer = -1;
            else{
              var descArr = desc.split(" ");
              var tempArrMajor = descArr[2].split(".");
              var verMajor = tempArrMajor[0];
              var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
              var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
              flashVer =  parseFloat(verMajor + "." + verMinor);
            }
          }
          // WebTV has Flash Player 4 or lower -- too low for video
          else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;      var verArr = reqVerStr.split(",");
          var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
      
          if (flashVer < reqVer){
            if (confirm(msg))
              window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
          }
        }
      }
    }//-->
    </script>
    </head><body onload="MM_CheckFlashVersion('7,0,0,0','本页内容需要使用较新的 Macromedia Flash Player 版本。是否现在下载它?');">
    <div align="center">
      <div id="Layer1">
        <table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#808080">
          <tr>
            <td><table width="700" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><div align="right"><img src="searchb7.gif" width="30" height="30" style="cursor:hand" onclick="Hide()" /></div></td>
                </tr>
              </table>
                <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="380"><div align="left"><span class="STYLE1">&nbsp;&nbsp;&nbsp;</span></div></td>
                    <td width="380"><div align="left"></div></td>
                    <td width="40"><div align="right"></div></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="380"><div align="left"><span class="STYLE2">&nbsp;&nbsp;</span></div></td>
                    <td width="380"><div align="center"></div></td>
                    <td width="40">&nbsp;</td>
                  </tr>
                </table>
              <table width="550" height="350" border="1" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div id="container"><a href="http://www.macromedia.com/go/getflashplayer"></div>
                       
                      &nbsp;</td>
                  </tr>
                </table>
              <table width="550" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="STYLE1"><div align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div></td>
                  </tr>
                </table>
              <div align="right"></div></td>
          </tr>
        </table>
      </div>
    </div>
    <p align="center">&nbsp;</p>
        <input id="Button1" type="button" value="显示层" onclick="Show()"/>
        <input id="Button2" type="button" value="隐藏层" onclick="Hide()"/></body>
    </html>
     <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">
    var s1 = new SWFObject("player.swf","ply","628","400","9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars","file=video_2.flv");
    s1.write("container");    function Show() {

            s1 = new SWFObject("player.swf","ply","628","400","9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars","file=video_2.flv");
    s1.write("container");
            ply = document.getElementById("ply").object;
            document.getElementById("container").appendChild(document.getElementById("ply"));
    document.getElementById("container").style.display="";

        }    function Hide() {
            document.getElementById("container").style.display="none";
    document.getElementById("container").removeChild(document.getElementById("ply"));
        }
    </script>
    <script type="text/javascript">  
    </script>
      

  4.   

    早说嘛,看效果,下班了~~~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <style type="text/css">
    <!--
    .STYLE1 {
    font-size: 14px;
    color: #009933;
    }
    .STYLE2 {font-size: 18px}
    .STYLE5 {
    font-size: 24px;
    color: #00CC00;
    }
    .STYLE6 {font-size: 18}
    .STYLE7 {font-size: 16px}
    .STYLE8 {color: #0000FF}
    .STYLE9 {color: #00CC00}
    .STYLE31 { color: #00CC00;
    font-size: 18px;
    }
    #Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 279px;
    top: 14px;
    }
    -->
    </style>
    <script type="text/javascript">
    <!--function MM_CheckFlashVersion(reqVerStr,msg){
      with(navigator){
        var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
        var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
        if (!isIE || !isWin){  
          var flashVer = -1;
          if (plugins && plugins.length > 0){
            var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
            desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
            if (desc == "") flashVer = -1;
            else{
              var descArr = desc.split(" ");
              var tempArrMajor = descArr[2].split(".");
              var verMajor = tempArrMajor[0];
              var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
              var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
              flashVer =  parseFloat(verMajor + "." + verMinor);
            }
          }
          // WebTV has Flash Player 4 or lower -- too low for video
          else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;      var verArr = reqVerStr.split(",");
          var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
      
          if (flashVer < reqVer){
            if (confirm(msg))
              window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
          }
        }
      }
    }//-->
    </script>
    </head><body onload="MM_CheckFlashVersion('7,0,0,0','本页内容需要使用较新的 Macromedia Flash Player 版本。是否现在下载它?');">
    <div align="center">
      <div id="Layer1">
        <table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#808080">
          <tr>
            <td><table width="700" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><div align="right"><img src="searchb7.gif" width="30" height="30" style="cursor:hand" onclick="Hide()" /></div></td>
                </tr>
              </table>
                <table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="380"><div align="left"><span class="STYLE1">&nbsp;&nbsp;&nbsp;</span></div></td>
                    <td width="380"><div align="left"></div></td>
                    <td width="40"><div align="right"></div></td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td width="380"><div align="left"><span class="STYLE2">&nbsp;&nbsp;</span></div></td>
                    <td width="380"><div align="center"></div></td>
                    <td width="40">&nbsp;</td>
                  </tr>
                </table>
              <table width="550" height="350" border="1" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td><div id="container" style="display:none"><a href="http://www.macromedia.com/go/getflashplayer"></div>
                       
                      &nbsp;</td>
                  </tr>
                </table>
              <table width="550" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td class="STYLE1"><div align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div></td>
                  </tr>
                </table>
              <div align="right"></div></td>
          </tr>
        </table>
      </div>
    </div>
    <p align="center">&nbsp;</p>
        <input id="Button1" type="button" value="显示层" onclick="Show()"/>
        <input id="Button2" type="button" value="隐藏层" onclick="Hide()"/></body>
    </html>
     <script type="text/javascript" src="swfobject.js"></script>
    <script type="text/javascript">


    var ply = null;    function Show() {
            var s1 = new SWFObject("player.swf","ply","628","400","9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars","file=video_2.flv");
    s1.write("container");
            ply = document.getElementById("ply");
            document.getElementById("container").appendChild(ply);
    document.getElementById("container").style.display="";

        }    function Hide() {
            document.getElementById("container").style.display="none";
    document.getElementById("container").removeChild(document.getElementById("ply"));
        }
    </script>
    <script type="text/javascript">  
    </script>