New image in every refresh.
2 posters
Page 1 of 1
New image in every refresh.
Hello guys.
I want your help. How can i make my forum's banner change in every refresh? I mean, i want to add a lot of banners which will change when a member refresh a forum's page.
Thanks in advance
I want your help. How can i make my forum's banner change in every refresh? I mean, i want to add a lot of banners which will change when a member refresh a forum's page.
Thanks in advance
Last edited by Mix4lis on September 26th 2013, 3:19 pm; edited 2 times in total
Mix4lis- New Member
- Posts : 5
Reputation : 5
Language : Greek
Location : Athens
Re: New image in every refresh.
Hi Mix4lis, add a new javascript, placement: In all pages
- Code:
$(function(){
var banner = new Array();
banner[0] = "URL_banner_1";
banner[1] = "URL_banner_2";
banner[2] = "URL_banner_3";
//if you need you can add more...
function randombanner() {
var randomnum= Math.floor(Math.random() * banner.length);
$( "#pun-logo > img" ).attr("src", banner[randomnum]);
}
window.onload=randombanner;
});
Sr.Smith- Forumember
- Posts : 94
Reputation : 11
Language : Spanish
Re: New image in every refresh.
Although i have Javascript enabled, it didn't work... I tried some javascript codes similar to the one you gave me, but they didn't work either. Do i have to change something else, except from the URL of the banners? For example, values?
Mix4lis- New Member
- Posts : 5
Reputation : 5
Language : Greek
Location : Athens
Re: New image in every refresh.
No, you don't have to change other things, only the URL.
But what you say makes me think that you could have some error/s in your other javascripts. If you have an error in a javascript the other ones may don't work.
You can prove to export your other javascript for example to the notepad and prove this javascript alone.
Good luck.
But what you say makes me think that you could have some error/s in your other javascripts. If you have an error in a javascript the other ones may don't work.
You can prove to export your other javascript for example to the notepad and prove this javascript alone.
Good luck.
Sr.Smith- Forumember
- Posts : 94
Reputation : 11
Language : Spanish
Re: New image in every refresh.
I had already removed all javascripts in case of errors, but it did't work.
Well, i'll give a try one more time.
Well, i'll give a try one more time.
Mix4lis- New Member
- Posts : 5
Reputation : 5
Language : Greek
Location : Athens
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum