2

我在页面加载时有一个查询字符串,用于获取 JWPlayer 的文件名和缩略图。但是,它没有获取文件名或缩略图名。从后面的 VB 代码中,我无法将其转移到我的 aspx 页面一定是有原因的。请参阅代码:

Code Behind (VB):
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Dim videoName As String = Request.QueryString("FileName")
    Dim thumb As String = Request.QueryString("Thumb")
End Sub

现在我需要将这些字符串变量放入 JWplayer 脚本的 .ASPX 页面中,但它们没有

.ASPX:
<div id='container'></div>
<script type="text/javascript" src="~/player/jwplayer.js</script>
<script type="text/javascript">
        jwplayer("container").setup({                
            file: videoName,
            flashplayer: '~/player/player.swf',
            volume: 35,
            width: 480,
            height: 270,
            skin: '~/player/skins/skin.zip',
            image: thumb,                
        })
</script>
4

1 回答 1

0

这就是我解决的问题

Code Behind (VB):

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
   Dim videoName As String = Request.QueryString("FileName")
   Dim thumb As String = Request.QueryString("Thumb")
   Dim dur As String = Request.QueryString("Duration").ToString()


    txt1.Text = "~contents/published/" & videoName.ToString()
    txt2.Text = "~/contents/thumbs/" & thumb.ToString()
    txt3.Text = dur.ToString()

End Sub

现在要将查询字符串的值传递给 JWPlayer javascript,我必须在 JW 脚本中添加一个 javascript 函数,并将其命名为 codeAddress()。在 LongTail 网站或教程或我发现的 Internet 上的其他任何地方都找不到此类文档。

.ASPX:
<script type="text/javascript">
        function codeAddress() {
            var dootoo = document.getElementById('<%=txt1.ClientID%>').value;
            var doothree = document.getElementById('<%=txt2.ClientID%>').value;
            var doofour = document.getElementById('<%=txt3.ClientID%>').value;
            jwplayer("container").setup({
                duration: doofour,
                file: dootoo,
                flashplayer: '~/player/player.swf',
                skin: "~/player/skins/newtubedark.zip",
                volume: 35,
                width: 685,
                height: 385,
                image: doothree,

            })
        }
        window.onload = codeAddress;
    </script>
<asp:textbox id="txt1" runat="server" style="display:none;"></asp:textbox>
    <asp:textbox id="txt2" runat="server" style="display:none;"></asp:textbox>
    <asp:textbox id="txt3" runat="server" style="display:none;"></asp:textbox>
于 2013-04-22T16:04:37.700 回答