...

View Full Version : Show button after pages viewed



tb582
01-09-2007, 04:14 PM
Hi guys currently working on a site and it requires that you view two specific pages before you can continue on. I need it so that once a user visits these two pages on the site a button appears on the main page for them to click on....any ideas?

SpirtOfGrandeur
01-09-2007, 05:15 PM
In JS you could drop cookies based on page view and display the button based on that.

Or on any server side technology you can use either a DB or Session's.

tb582
01-10-2007, 02:59 AM
I would need to use JS, any ideas on the coding?

SpirtOfGrandeur
01-10-2007, 03:08 AM
Here (http://www.quirksmode.org/js/cookies.html?cookievalue=asdasd#) is an example page on how to do it...

tb582
01-10-2007, 05:59 AM
Ok thanks for the link, I read it over and it was great info but for some reason I cannot formulate the code.....

I got two pages .../html/services.html and ../html/list11.html , that the users must visit before the a button will appear on ../html/main.html


thanks

tb582
01-10-2007, 04:37 PM
I seem to be continuing to struggle with this code, can anyone give me a hand?

SpirtOfGrandeur
01-10-2007, 05:39 PM
When /html/services.html is hit you drop a cookie

When /html/list11.html is hit you drop a cookie

On /html/main.html you check to see if the cookie is there and if it is you display the link. The problem is in JS the link will always be in the source so it is not really hiding it. It is making it invisible...

And besides writing it out for you, I gave you a really good guide on how to handle it.

tb582
01-10-2007, 05:42 PM
LOL writing it out would be great :thumbsup:

SpirtOfGrandeur
01-10-2007, 06:51 PM
Yea but you wouldn't learn a thing. I will help you if you get stuck on a certain piece of code or a certain idea, but I make way to much money per hour to sit here and work for free.

I am almost certain some one will pick up the slack though.

tb582
01-11-2007, 01:19 AM
I will help you if you get stuck on a certain piece of code or a certain idea, but I make way to much money per hour to sit here and work for free.

I am almost certain some one will pick up the slack though.


Ok so here is what I will put on the services.html page?

function createCookie(services,active,0) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = services+"="+active+0+"; path=/";
}


.... and on the list11.html page ?

function createCookie(chklist,active,0) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = chklist+"="+active+0+"; path=/";
}

is this correct? then what do I put on the main.html page to make sure those cookies are present, and how would I then if those cookies are present display that button?

tb582
01-11-2007, 02:24 PM
ok nevermind that code up above, I got the two cookies to create but now I just need to figure out how to get main.html to show that button if the cookie is there....

tb582
01-11-2007, 07:22 PM
I got the two cookies to create but now I just need to figure out how to get main.html to show that button if the cookie is there....


BUMP
:thumbsup:

Mr J
01-11-2007, 08:05 PM
I've attached some example pages, give them a try, it should give you the idea

tb582
01-11-2007, 09:25 PM
Thanks for the files I can take a look at them later on tonight when I get home from work....

In the meantime let me give the links so you can see exactly what i'm talking about....

Users will go to this page:
http://sph.bu.edu/OTLT/practicum/site/2/html/tenservices2.html

and then eventually to this page:
http://sph.bu.edu/OTLT/practicum/site/2/html/chklist11.html

When you go to each of those pages they set a cookie, now I need it so that if/when the users go back to : http://sph.bu.edu/OTLT/practicum/site/2/html/main.html it checks to see if they have been to those two pages, if not the page will display as is, if they have been to those two pages then I need a button to appear above the next button that will take them to a post test....

tb582
01-12-2007, 07:30 PM
BUMP :rolleyes:

Mr J
01-13-2007, 07:50 AM
What about the example files I posted?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum