Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Show button after pages viewed

    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?

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #3
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would need to use JS, any ideas on the coding?

  • #4
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is an example page on how to do it...
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #5
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I seem to be continuing to struggle with this code, can anyone give me a hand?

  • #7
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #8
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOL writing it out would be great

  • #9
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #10
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SpirtOfGrandeur View Post
    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?

  • #11
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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....

  • #12
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tb582 View Post
    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

  • #13
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    I've attached some example pages, give them a try, it should give you the idea
    Attached Files Attached Files
    Last edited by Mr J; 01-11-2007 at 08:14 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #14
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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/sit...services2.html

    and then eventually to this page:
    http://sph.bu.edu/OTLT/practicum/sit...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....

  • #15
    New Coder
    Join Date
    Aug 2006
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    BUMP


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •