The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

random image header

2 posters

Go down

random image header  Empty random image header

Post by anastas95 June 12th 2013, 8:00 pm

is there a way each time somebody refreshes or clicks on a new page of the forum to have  a different header?
anastas95
anastas95
Forumember

Posts : 55
Reputation : 1
Language : English, Greek

http://www.harryworld.org

Back to top Go down

random image header  Empty Re: random image header

Post by anastas95 June 14th 2013, 2:09 pm

anybody?
anastas95
anastas95
Forumember

Posts : 55
Reputation : 1
Language : English, Greek

http://www.harryworld.org

Back to top Go down

random image header  Empty Re: random image header

Post by Przmus June 14th 2013, 2:29 pm

Yeah...
You will have to write a javascript which adds and edits cookies, for example:
Code:
<script type="text/javascript">

var redirectPath = "./";
var redirectPage = ["index_second.html","index_third.html","index_fourth.html","index_fifth.html"];

var expDate = new Date();
expDate.setTime(expDate.getTime()+12*60*60*1000); // 12 hours

function deleteCookie(isName){

if (getCookie(isName))
{
document.cookie = isName + "="+ "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

function setCookie(isName,isValue,dExpires){

document.cookie = isName+"="+isValue+";expires="+dExpires.toGMTString();
}

function getCookie(isName){

var cookieStr = document.cookie;
var startSlice = cookieStr.indexOf(isName+"=");
if (startSlice == -1){return false}
var endSlice = cookieStr.indexOf(";",startSlice+1)
if (endSlice == -1){endSlice = cookieStr.length}
var isValue = cookieStr.substring(startSlice,endSlice).replace(/^.+\=/,"");
return isValue;
}

function init(){

var visits = getCookie('Visits');
if (visits)
{
visits++;
if (visits < 7)
{
// self.location.href = redirectPath + redirectPage[visits-1];
}
else   {
// self.location.href = redirectPath + redirectPage[redirectPage.length];
}
}
else {
visits = 1;
}
setCookie('Visits',"1",expDate);   
}

navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);   

</script>

To change the logo, you will need something like this:
Code:
document.getElementById('i_logo').src='http://link2secondImage.jpg';

You should add it instead of:
Code:
// self.location.href = redirectPath + redirectPage[visits-1];
or
Code:
// self.location.href = redirectPath + redirectPage[redirectPage.length];
or add after this:
Code:
visits = 1;

I'm not sure if it works correctly, I used the "visits" script for other things.
You will have to add/change some values.

EDIT:
And I recommend to add this code at the end of Templates -> General -> overall_footer_end, but before: < / body > < / html > tags.
avatar
Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum