Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个标签,我有音频的名称,
<asp:Label ID="lblSound" runat="server" Text="sound.mp3"></asp:Label>
我使用以下代码在我的 aps .net 网页中实现了一个 HTML5 音频播放器:
<audio controls> <source src="Sound/"></audio>
是否可以从标签中获取文本并将其插入“source src =“Sound/HERE”?
提前致谢
我这样解决了我的问题:<audio controls> <source src="Sound/<%=FilePath %>" /></audio>
<audio controls> <source src="Sound/<%=FilePath %>" /></audio>
我声明了一个全局字符串:protected string FilePath = "";
protected string FilePath = "";
并在页面加载:FilePath = lblSound.Text;
FilePath = lblSound.Text;