/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] why situation not on page load only….

Hello, I need the following items to change on page load only is main issue I’m having but they won’t and really could use some help. They only will if there is an alert plus a setTimeout both included in the script as well. Demo script found here: [url]http://www.mooonbaby.com/testkook.html[/url]
If one cookie is read goes to next item and sets a cookie. If that cookie is read goes to next item and sets a different cookie and so on. Need it to change from one item to the next on page load only instead without the alerts and settimeouts. Please don’t redo most of the code so I can understand any changes that are being made in case I need to redo any more. Can someone please tell me how to have these items change by cookie by page load only? Please let me know, thank you very much.

[QUOTE]

var kie=[];
kie[1] = [“<img style=’margin-left: 0px;margin-top:0px’ title=’Image’ border=’0′ src=’http://www.mooonbaby.com/feature/feature1/154534_18_856.jpg‘ />”];
kie[2] = [“<img style=’margin-left: 0px;margin-top:0px’ title=’Image’ border=’0′ src=’http://www.mooonbaby.com/feature/feature1/287405_3e_8a0.jpg‘ />”];
kie[3] = [“<img style=’margin-left: 0px;margin-top:0px’ title=’Image’ border=’0′ src=’http://www.mooonbaby.com/feature/feature1/588769_blu_1.jpg‘ />”];
kie[4] = [“<img style=’margin-left: 0px;margin-top:0px’ title=’Image’ border=’0′ src=’http://www.mooonbaby.com/feature/feature1/608151_beach.jpg‘ />”];
kie[5] = [“<img style=’margin-left: 0px;margin-top:0px’ title=’Image’ border=’0′ src=’http://www.mooonbaby.com/feature/feature1/642453_church_owl.jpg‘ />”];

document.cookie = ‘o=o; expires=Aug 2009 UTC; path=/’

var counter = 1;

function getkie()
{if (document.cookie=’o=o’){
document.getElementById(“kie”).innerHTML = kie[counter];
counter++; if (counter == kie.length)

{counter = 1; } alert(document.cookie); setTimeout(‘getkie()’, 9000); document.cookie = ‘o=oo; expires=Aug 2009 UTC; path=/’ }
if (document.cookie=’o=oo’){
document.getElementById(“kie”).innerHTML = kie[counter];
counter++; if (counter == kie.length)

{counter = 1; } alert(document.cookie); setTimeout(‘getkie()’, 9000); document.cookie = ‘o=o; expires=Aug 2009 UTC; path=/’ }}

[/QUOTE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @vortexer 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 5.4,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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