我正在使用jw播放器创建一个网站,但我无法在.cs文件中读取值表单变量到aspx文件中的脚本
在我的班级文件.cs
中private string temp;
protected void Page_Load(object sender, EventArgs e)
{
temp = "var ten= 'Nameofmusic';";
if (!ClientScript.IsClientScriptBlockRegistered("myScript"))
{
ClientScript.RegisterClientScriptBlock(typeof(nghe), "myScript", temp, false);
}
}
在我的aspx文件中
<script type="text/javascript" id="flash">
function getname() {
var st = ten;
return st;
}
var cssSelector = {
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
};
var options = {
playlistOptions:
{
loop: "true",
autoPlay: true,
enableRemoveControls: true,
loopOnPrevious: true,
shuffleOnLoop: true
},
swfPath: "js", supplied: "mp3, oga, m4v"
};
var names = getname();
var playlist = [
{
artist: "Various Artists",
title: names,
mp3: encodeURI("flash/media/songs/LangTrongTimThuc.mp3"),
poster: ("flash/graphics/jplayer_playlister_poster.png")
}];
$(document).ready(function () {
var myplaylist = new jPlayerPlaylist(cssSelector, playlist, options);
});
</script>
为什么不运行? 但是当我放置
var names = getname();
通过
var names = "abcd";
它被运行了。谁能帮我 ? 每个人都感谢。