/    Sign up×
Community /Pin to ProfileBookmark

Onload, domready and browser back button

When a user visits the mysite.com/gamelist.php page, the featured games are displayed as in the image below:
[IMG]http://img153.imageshack.us/img153/9477/clip3v.jpg[/IMG]

But when a user visits another page, then uses the IE8 back button,neither the links nor the images of the featured games are displayed as depicted in the image below:
[IMG]http://img842.imageshack.us/img842/2033/clip4s.jpg[/IMG]

I’ve already spent many hours Googling and trying everything I find but nothing works. I tired unonload, meta no cache, etc.

Anyone have any ideas on how to fix?

Here’s a snippet of the code from gamelist.tpl:

[code]
{include file=’header.tpl’}
{* game.tpl 2009-05-29 16:50:27 rhutton *}
{* Social Engine Guru.com *}
<!–<h1>{lang_print id=$aCusLang.browse_games}</h1>–>

{literal}

<div style=”width:470px; float:left”>

<link rel=”stylesheet” href=”file/arcade/css/jd.gallery.css” type=”text/css” media=”screen” charset=”utf-8″ />

<!– Arcade Javascripts –>
<script src=”file/arcade/scripts/mootools-1.2.1-core-yc.js” type=”text/javascript”></script>
<script src=”file/arcade/scripts/mootools-1.2-more.js” type=”text/javascript”></script>
<script type=”text/javascript” src=”file/arcade/scripts/settings.js”></script>

<script type=”text/javascript”>
function startGallery() {
var myGallery = new gallery($(‘myGallery’), {
timed: true
});
}
[COLOR=”SeaGreen”]window.addEvent(‘domready’,startGallery);[/COLOR]

var allHTMLTags = new Array();

var ei = 0;

function getElementByClass(theClass) {

//Create Array of All HTML Tags
var allHTMLTags=document.getElementsByTagName(“*”);

//Loop through all tags using a for loop
for (i=0; i<allHTMLTags.length; i++) {

//Get all tags with the specified class name.
if (allHTMLTags[i].className==theClass) {

var game=new Array(); // regular array (add an optional integer

{/literal}
{foreach from=$featuredgames item=k value=v}

game[{$k.i}]='<h2 style=”color:#555555″>
{$k.title}</h2>
<div style=”width:180px;float:left; margin-left: 15px; margin-right: 10px; height:170px; overflow:hidden;”>{$k.description}</div><img width=”150px” src=”./file/arcade/images/{$k.img}” alt=”image” />’;

{/foreach}

{literal}

allHTMLTags[i].innerHTML = ‘

<div style=”margin:auto; width:370px;”><span style=”color:#555555; font-size: 20px;”>Featured Games</span>’+game[ei]+'</div>’;

ei++;
}
}
}

[COLOR=”SeaGreen”]window.onload = function() {getElementByClass(‘slideElement’)};[/COLOR]

</script>

{/literal}

<div class=”content1″ style=”color:white; border:0;”>
<div id=”myGallery” style=”border:0;”>

{foreach from=$featuredgames item=k value=v}
<div class=”imageElement”>
<h3>{$k.title}</h3>
<p> </p>
<a href=”game.php?play={$k.gameid}” title=”{$k.title}” class=”open”></a>
<img src=”pixel.png” class=”full” alt=”image” />
<img src=”file/arcade/images/{$k.img}” class=”thumbnail” alt=”image” />
</div>
{/foreach}

</div>
</div>

</div>

[/code]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @jeffshead spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...