1.前台js

<script type="text/javascript">

function playMusic(width,height,isStart,videolink)

    {

     var oeTags = '<object id="mediaPlayer" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'

         + 'width="' + width + '" height="' + height + '"'

         + 'codebase="​​http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"'​

         + 'standby="Loading Microsoft Windows Media Player components..."'

         + 'type="application/x-oleobject">'

         + '   <param name="autoStart" value="'+isStart+'"/>'

         + '   <param name="url"       value="' + videolink + '" />'

         + '   <param name="wmode"     value="transparent" />'

         + '   <param name="uiMode"    value="full" />'

         + '   <param name="loop"      value="false" />'

         + '   <embed id       ="EmbedmediaPlayer"'

         + '       type        ="application/x-mplayer2"'

         + '       src         ="' + videolink + '"'

         + '       width       ="' + width + '"'

         + '       height      ="' + height + '">'

         +'        autoStart   ="'+isStart+'" '

         + '   </embed>'

         + '</object>';

    document.write(oeTags);

    }

</script>

2.后台cs

 protected void BtnStop_Click(object sender, EventArgs e)

        {

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>playMusic(0,0,false,'天路.wma')</script>");

        }


可以更换数据库中的路径,及大小,是否显示。


作者:​​水木​​