以及這是我的問題,這可能是我自己非常明顯和愚蠢的錯誤,我似乎無法注意到,我沒有用JavaScript很多。 我認爲這段代碼很明顯,我顯示3個.swf文件,並且根據生成3個隨機數的腳本的結果,我想編輯嵌入式Flash動畫的「src」和「value」屬性。無法設置屬性與JavaScript
我試圖通過使用setAttribute和公正element.value都=「ECC ..」 沒有工作,屬性保持不變
<!DOCTYPE HTML>
<html>
<head>
<title>example</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<script type="text/javascript">
var prereel1=Math.floor(Math.random()*25);
var reel1="flash/"+ prereel1 + ".swf";
var prereel2=Math.floor(Math.random()*25);
var reel2="flash/"+ prereel2 + ".swf";
var prereel3=Math.floor(Math.random()*25);
var reel3="flash/"+ prereel3 + ".swf";
document.getElementById("slot1").value=reel1;
document.getElementById("slot2").setAttribute("value", reel2);
document.getElementById("slot3").setAttribute("value", reel3);
document.getElementById("eslot1").src=reel1;
document.getElementById("eslot2").setAttribute("src", reel2);
document.getElementById("eslot3").setAttribute("src", reel3);
</script>
<div id="slots">
< object width="150" height="210">
<param id="slot1" name="movie" value="flash/1.swf">
<embed id="eslot1" src="flash/1.swf" width="150" height="210">
</embed>
</object><object width="150" height="210">
<param id="slot2" name="movie" value="flash/1.swf">
<embed id="eslot2" src="flash/1.swf" width="150" height="210">
</embed>
</object><object width="150" height="210">
<param id="slot3" name="movie" value="flash/1.swf">
<embed id="eslot3" src="flash/1.swf" width="150" height="210">
</embed>
</object>
</div>
</body>
</html>
如果你要執行立即將JavaScript代碼放在**內容後面。 – 2011-04-18 00:22:23