Banner in JS, “ animation ” part not working?
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>I need to use this code specificly but i do not understnd why isnt my banner working. Links in banner are functional but image "animatio" isnt. Pls help
javascript
add a comment |
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>I need to use this code specificly but i do not understnd why isnt my banner working. Links in banner are functional but image "animatio" isnt. Pls help
javascript
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
2
Where do you ever call therotate()function?
– David
Nov 13 '18 at 11:32
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54
add a comment |
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>I need to use this code specificly but i do not understnd why isnt my banner working. Links in banner are functional but image "animatio" isnt. Pls help
javascript
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>I need to use this code specificly but i do not understnd why isnt my banner working. Links in banner are functional but image "animatio" isnt. Pls help
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setTimeout('rotate();', 5000);
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>javascript
javascript
edited Nov 13 '18 at 11:33
David
148k28143209
148k28143209
asked Nov 13 '18 at 11:29
TheStworTheStwor
13
13
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
2
Where do you ever call therotate()function?
– David
Nov 13 '18 at 11:32
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54
add a comment |
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
2
Where do you ever call therotate()function?
– David
Nov 13 '18 at 11:32
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
2
2
Where do you ever call the
rotate() function?– David
Nov 13 '18 at 11:32
Where do you ever call the
rotate() function?– David
Nov 13 '18 at 11:32
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54
add a comment |
2 Answers
2
active
oldest
votes
You never invoke the rotate function. Instead of using setTimeout inside the function to keep re-invoking itself (without first invoking it to start that process), call setInterval once from outside the function. Something like this:
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
This will invoke the rotate function repeatedly in 5-second intervals.
For example:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the imagesrcas expected. Do you have an example which isn't doing this?
– David
Nov 13 '18 at 12:48
add a comment |
You are not calling the rotate function.
You have to remove the timeOut from within the function and keep it separatelly.
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
Now, the rotate function are only counting the sponsor variable and changing the src of the image. We are calling the function through the setInterval: it will init and execute the next calls for every 5 seconds.
Check the fiddle below:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>Ps: added a title attribute to the images, since we are not displaying here the original files and it could be difficult to see the transitions.
I hope it helps.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280061%2fbanner-in-js-animation-part-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You never invoke the rotate function. Instead of using setTimeout inside the function to keep re-invoking itself (without first invoking it to start that process), call setInterval once from outside the function. Something like this:
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
This will invoke the rotate function repeatedly in 5-second intervals.
For example:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the imagesrcas expected. Do you have an example which isn't doing this?
– David
Nov 13 '18 at 12:48
add a comment |
You never invoke the rotate function. Instead of using setTimeout inside the function to keep re-invoking itself (without first invoking it to start that process), call setInterval once from outside the function. Something like this:
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
This will invoke the rotate function repeatedly in 5-second intervals.
For example:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the imagesrcas expected. Do you have an example which isn't doing this?
– David
Nov 13 '18 at 12:48
add a comment |
You never invoke the rotate function. Instead of using setTimeout inside the function to keep re-invoking itself (without first invoking it to start that process), call setInterval once from outside the function. Something like this:
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
This will invoke the rotate function repeatedly in 5-second intervals.
For example:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>You never invoke the rotate function. Instead of using setTimeout inside the function to keep re-invoking itself (without first invoking it to start that process), call setInterval once from outside the function. Something like this:
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
This will invoke the rotate function repeatedly in 5-second intervals.
For example:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.png" border=0></a>edited Nov 13 '18 at 12:47
answered Nov 13 '18 at 11:37
DavidDavid
148k28143209
148k28143209
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the imagesrcas expected. Do you have an example which isn't doing this?
– David
Nov 13 '18 at 12:48
add a comment |
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the imagesrcas expected. Do you have an example which isn't doing this?
– David
Nov 13 '18 at 12:48
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
I just tryed that, does not work. - The links in a banner are rotating every 5 sec as well nad that does work only image is a problem
– TheStwor
Nov 13 '18 at 11:44
@TheStwor: What specifically isn't working? The snippet in the answer is changing the image
src as expected. Do you have an example which isn't doing this?– David
Nov 13 '18 at 12:48
@TheStwor: What specifically isn't working? The snippet in the answer is changing the image
src as expected. Do you have an example which isn't doing this?– David
Nov 13 '18 at 12:48
add a comment |
You are not calling the rotate function.
You have to remove the timeOut from within the function and keep it separatelly.
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
Now, the rotate function are only counting the sponsor variable and changing the src of the image. We are calling the function through the setInterval: it will init and execute the next calls for every 5 seconds.
Check the fiddle below:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>Ps: added a title attribute to the images, since we are not displaying here the original files and it could be difficult to see the transitions.
I hope it helps.
add a comment |
You are not calling the rotate function.
You have to remove the timeOut from within the function and keep it separatelly.
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
Now, the rotate function are only counting the sponsor variable and changing the src of the image. We are calling the function through the setInterval: it will init and execute the next calls for every 5 seconds.
Check the fiddle below:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>Ps: added a title attribute to the images, since we are not displaying here the original files and it could be difficult to see the transitions.
I hope it helps.
add a comment |
You are not calling the rotate function.
You have to remove the timeOut from within the function and keep it separatelly.
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
Now, the rotate function are only counting the sponsor variable and changing the src of the image. We are calling the function through the setInterval: it will init and execute the next calls for every 5 seconds.
Check the fiddle below:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>Ps: added a title attribute to the images, since we are not displaying here the original files and it could be difficult to see the transitions.
I hope it helps.
You are not calling the rotate function.
You have to remove the timeOut from within the function and keep it separatelly.
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "" + sponsor + ".jpg"
window.setInterval(rotate, 5000);
Now, the rotate function are only counting the sponsor variable and changing the src of the image. We are calling the function through the setInterval: it will init and execute the next calls for every 5 seconds.
Check the fiddle below:
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>Ps: added a title attribute to the images, since we are not displaying here the original files and it could be difficult to see the transitions.
I hope it helps.
var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>var sponsor = 1;
function goBanner()
if (sponsor == 1)
window.location.href = "http://www.pavucina.sk";
if (sponsor == 2)
window.location.href = "http://forum.sk";
if (sponsor == 3)
window.location.href = "http://superzoznam.sk";
function rotate()
if (++sponsor > 3) sponsor = 1;
document.images[0].src = sponsor + ".jpg";
document.images[0].title = "Image " + sponsor;
window.setInterval(rotate, 3000);<html>
<head>
<title>Banner</title>
</head>
<body>
<a href="javascript:goBanner();"><img class="slikaF" name="banner" src="1.jpg" title="Image 1" border="0"></a>
</body>
</html>edited Nov 13 '18 at 11:56
answered Nov 13 '18 at 11:47
EduardoEduardo
158113
158113
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280061%2fbanner-in-js-animation-part-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please format the question properly and edit the tag to JavaScript, not Java.
– achAmháin
Nov 13 '18 at 11:31
2
Where do you ever call the
rotate()function?– David
Nov 13 '18 at 11:32
@achAmháin Java was a mistype i apologize
– TheStwor
Nov 13 '18 at 11:34
ˇ@David that is the scheme of the code i am soposed to do it. I gave you the same instruction that i got. I am cracking my head with it a few hours and i do not get it. any help would relly br good.
– TheStwor
Nov 13 '18 at 11:37
You can not expect us to be able to fix your issues that relate to external code or instructions you have been given, when we don’t even know what those are. If you have insufficient information from whoever gave this to you, then you should ask them about it first of all. If you need our help, then the least you need to do is provide a proper Minimal, Complete, and Verifiable example.
– misorude
Nov 13 '18 at 11:54