我正在制作一个Flash画廊网站,我希望页面底部的文本是闪存的下载链接。此文本更改为当前显示的当前闪存的标题。我希望href标签动态更改以匹配正在播放的特定闪存的文件路径,以便用户可以下载它。这是我第一次玩下载链接,更不用说那些随变量动态变化的链接了。所以简而言之,我希望链接更改为链接数组中存在的文件路径。
包含动态链接的起始代码的函数称为DOWNLOAD
HTML
<body>
<div id="titleText">
<h1>Anon Curb</h1>
</div>
<div id="flashmovie">
<object type="application/x-shockwave-flash" data="swfs/welcomeflash.swf">'+
<param name="movie" value="swfs/welcomeflash.swf">
</object>
</div>
<!-- end #container -->
<div id="buttonCon">
<div id="buttons">
<button id="next">next</button>
<button id="rand">Random</button>
<button id="back">Back</button>
</div>
</div>
<div id="titleCon">
<a href="#" id="downLink">
<div id="title">Hit random button</div>
</a>
</div>
<!-- end #wrapper -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
<script src="js/flashcollection.js"></script>
</body>
JAVASCRIPT
$(document).ready(function () {
var links = [
'swfs/#1%20(Special%20Japanese%20Extended%20Dance%20Mix).swf',
'swfs/$D6.swf',
'swfs/(MAD)%20Huh.swf'
];
var displaytext = [
'#1 (Special Japanese Extended Dance Mix)',
'$D6',
'(MAD) Huh'
];
var c = 0
var flashmovie, test, temp;
function init() {
flashmovie = document.getElementById('flashmovie');
document.getElementById('back').onclick = function () {
if (c == 0) {
c = links.length;
}
c--
displayFiles();
}
document.getElementById('next').onclick = function () {
if (c == links.length - 1) {
c = -1;
}
c++;
displayFiles();
}
document.getElementById('rand').onclick = function () {
temp = c;
while (c == temp) {
c = Math.floor(Math.random() * links.length);
}
displayFiles();
}
}
相关分类