【发布时间】:2016-09-06 00:52:20
【问题描述】:
我正在制作一个 Flash 画廊,我希望每次在页面上显示新的 Flash 时重新加载页面。我想这样做是因为我想增加每次用户访问显示的广告数量。按钮单击成功重新加载页面,但阻止未来代码触发,这就是显示 Flash 的内容。
var c = 0;
var flashcon, test, temp;
// Function for inital flash page to work properly
function init() {
flashcon = document.getElementById('flashcon');
// Scripts for the buttons
document.getElementById('back').onclick = function () {
location.reload(false);
if (c == 0) {
c = paths.length;
}
c--;
displayFiles();
download();
}
document.getElementById('next').onclick = function () {
location.reload(false);
if (c == paths.length - 1) {
c = -1;
}
c++;
displayFiles();
download();
}
document.getElementById('rand').onclick = function () {
location.reload(false);
temp = c;
while (c == temp) {
c = Math.floor(Math.random() * paths.length);
}
displayFiles();
download();
}
// Scripts for the left and right arrow key functionality
document.addEventListener('keydown', function (e) {
if (e.which == 37) {
$("#back").click();
}
});
document.addEventListener('keydown', function (e) {
if (e.which === 39) {
$("#next").click();
}
});
}
【问题讨论】:
标签: javascript jquery html flash