如果您有以下内容:
<object type="application/x-shockwave-flash" height="609" width="1000" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=jonnyflyspeed" bgcolor="#000000">
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="allowNetworking" value="all" />
<param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />
<param name="flashvars" value="hostname=www.twitch.tv&channel=CHANNELNAMEHERE&auto_play=true&start_volume=75" />
</object>
有没有办法更改value="hostname=www.twitch.tv&channel=CHANNELNAMEHERE&auto_play=true&start_volume=75"
,特别是使用普通文本链接更改值的CHANNELNAMEHERE部分?例如:
<a href="#" value="NEWCHANNELNAME">
答案 0 :(得分:0)
通过使用新细节重新加载整个对象来对其进行排序:
链接是:
<a onclick="changeChannel('CHANNELNAME')">
<script>
function changeChannel(intValue){
document.getElementById("test").innerHTML = '<object type="application/x-shockwave-flash" height="609" width="1000" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel='+intValue+'" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel='+intValue+'&auto_play=true&start_volume=75" /></object>'
}
</script>