PDA

View Full Version : Display time of last visit


betrella
04-27-2007, 09:12 AM
Hi, my english is not so good, but i try. i found this: http://codingforums.com/archive/index.php?t-103802.html
and now i wondering how i could give message up to 20 times?:confused:

betrella
04-27-2007, 09:19 AM
I mean the last one.

david_kw
04-27-2007, 04:24 PM
I'm not sure what you mean. After the person has visited your site 20 times you don't want the "welcome back" to be displayed any more?

If so, I think you could just change the body part of the script like this


<body>
<script>
if (Count()==1){
document.write("This is your 1st visit to our page");
When();
} else if (Count() > 20) {
// do nothing since the user has been here over 20 times
} else if (Count()>1) {
document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.");
}
</script>
</body>


david_kw

betrella
04-27-2007, 06:56 PM
I mean, if I want to customize the messages in 20 diffrent welcome.

<script>
if (Count()==1){
document.write("This is your 1st visit to our page")
When()
}
else if (Count()>1)
document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.")
</script>

If I want to follow up with: Hi are you here again..Your last visit was on

This is the 4. time...Your last visit was on
5. time.....Your last visit was on

I try to copy:

When()
}
else if (Count()>1)
document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.")

and change the number >1) to 2 and 3, but wouldn`t go.

Sorry for my english

david_kw
04-27-2007, 10:00 PM
I see, you could try something like this


<body>
<script>
var count = Count();
var w = When();
if (count == 1) {
document.write("This is your first visit to our page.");
} else if (count == 2) {
document.write("Back again for a second time! Your last visit was on <b>" + w + "</b>.");
} else if (count == 3) {
document.write("We are glad you are back for a third time. Your last visit was on <b>" + w + "</b>.");
} else if (count < 21) {
document.write("Welcome back for your " + count + "th time. Your last visit was on <b>" + w + "</b>.");
} else {
document.write("Welcome back. Your last visit was on <b>" + w + "</b>.");
}
</script>
</body>


Hopefully that gives enough variety to help you understand how you could make changes for your own needs.

david_kw

betrella
04-27-2007, 10:54 PM
I try to use the script on this side: http://www.javascriptkit.com/script/script2/lastvisit.shtml
But it don’t show the last time, but the time when a visitor came to the side just now. So it have to say: the time is now:::
If you will, you can see what I`m trying to build, a side with fun stuff: http://home.no/juliettas/tullogtoys.htm
I think I get it now. You have helpt me out of lots of frustration.

Thank`s for good help. ;-):thumbsup: