我想更改嵌入对象的 src 属性。我有:
<embed class="flash "id="flash" src="swf/pano.swf?panoSrc=images/a.jpg"
allowFullScreen="true"
width="1280" height="640" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" bgcolor="#DDDDDD"/>
我试过了
function change()
{
document.getElementById("flash").setAttribute('src', 'swf/pano.swf?panoSrc=b.jpg');
}
但它在 Chrome 中不起作用,“仅”在 Firefox、IE 和 Opera 中起作用。我该如何修复它(使其在 Chrome 中工作)?我做错什么了吗?
编辑:这是整个 HTML 文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<script>
function change() {
document.getElementById("flash").setAttribute('src', 'swf/pano.swf?panoSrc=a.jpg');
}
</script>
</head>
<body>
<embed class="flash" id="flash" src="swf/pano.swf?panoSrc=images/sau.jpg" allowFullScreen="true"
width="1280" height="640" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" bgcolor="#DDDDDD"/>
<script>
change();
</script>
</body>