日期:2014-05-19  浏览次数:20780 次

网页播放器更改播放地址(高分求解)
我现在在网页中加上一个播放器,代码如下:
<object   id= "MediaPlayer "   height= "65 "   width= "500 "   classid= "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 "   VIEWASTEXT>
        <param   name= "URL "   value= "E:/document   of   nick/My   Music/茶汤.mp3 "   />
        <param   name= "rate "   value= "1 "   />
        <param   name= "balance "   value= "0 "   />
        <param   name= "currentPosition "   value= "0 "   />
        <param   name= "playCount "   value= "1 "   />
        <param   name= "autoStart "   value= "1 "   />
        <param   name= "currentMarker "   value= "0 "   />
        <param   name= "invokeURLs "   value= "-1 "   />
        <param   name= "volume "   value= "50 "   />
        <param   name= "mute "   value= "0 "   />
        <param   name= "uiMode "   value= "mini "   />
        <param   name= "stretchToFit "   value= "0 "   />
        <param   name= "windowlessVideo "   value= "0 "   />
        <param   name= "enabled "   value= "1 "   />
        <param   name= "enableContextMenu "   value= "0 "   />
</object>

用的WMP,在这个代码中我的播放地址参数 <param   name= "URL "   value= "E:/document   of   nick/My   Music/茶汤.mp3 "   /> 是硬编码上去的,但是我现在想将value值的值在后端动态的更改(后端代码用的C#),请问有什么方法可以达到这个目的??

------解决方案--------------------
在后端的cs文件中加一个public变量,如public string playurl;
然后在aspx文件中直接引用就可以了:
<param name= "URL " value= " <%=playurl%> " />
改成这样比较合理
<param name= "URL " value= " <%#playurl%> " />