random image header
2 posters
Page 1 of 1
random image header
is there a way each time somebody refreshes or clicks on a new page of the forum to have a different header?
Re: random image header
Yeah...
You will have to write a javascript which adds and edits cookies, for example:
To change the logo, you will need something like this:
You should add it instead of:
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.
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];
- Code:
// self.location.href = redirectPath + redirectPage[redirectPage.length];
- 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.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum