我有这段代码:
<embed src="http://mydomain/s/b.swf"
quality="high"
id="test"
bgcolor="#ffffff"
width="550"
height="400"
name="myFlashMovie" flashvars="Parameter1=3z3krkvhg0w3m0uhizp4wfdt98832&Parameter2=0"
align="middle"
allowscriptaccess="sameDomain"
allowfullscreen="false"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflash" />
我正在尝试通过jQuery或纯JS设置flashvars值,但我无法在文档准备就绪上设置它们,是否可以编辑该值?
我可以按控制台访问该对象,但无法编辑该值。
<script type="text/javascript">
jQuery(document).ready(function () {
console.log(getUrlParameter('Parameter1'));
console.log(getUrlParameter('Parameter2'));
var valueToShare = getUrlParameter('Parameter1') + getUrlParameter('Parameter2');
$('#test').find('embed').attr('FlashVars', 'adasdasda');
console.log($('#test').attr('FlashVars'));
function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
});
</script>