The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

random image header

View previous topic View next topic Go down

random image header

Post by anastas95 on June 12th 2013, 9: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
Forumember

Posts : 55
Reputation : 1
Language : English, Greek

http://www.harryworld.org

Back to top Go down

Re: random image header

Post by anastas95 on June 14th 2013, 3:09 pm

anybody?

anastas95
Forumember

Posts : 55
Reputation : 1
Language : English, Greek

http://www.harryworld.org

Back to top Go down

Re: random image header

Post by Przmus on June 14th 2013, 3: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.

Przmus
Forumember

Male Posts : 60
Reputation : 2
Language : English

http://easywinclan.forummotion.com/

Back to top Go down

View previous topic View next topic Back to top


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