Javascript Cookie to skip Splash Page
Eric LoCascio
Status: New User - Welcome
Joined: 11 Dec 2007
Posts: 4
Reply Quote
Hello - first time posting on your forum. I have to admit I mainly do flash and 3D animation, so my brain doesn't work the way yours does for programming - in other words, I'm not that good at it.

I have a client that wants a cookie placed on his splash page that has an intro on it - to skip the intro splash page for 24 hours and go to the homepage if the intro has been viewed . I found this great script on your site, that I think will work perfectly.

techpatterns.com/downloads/javascript_cookies.php

I read over it and get that you have to basically put in the 4 values for the function Set_Cookie. I downloaded the script and it's probably obvious, but I'm just not sure where to put it. In the javascripts that I have implemented in the past part goes in the heading and part goes directly in the body.

Any help would be much appreciated, and I thank you for your time. ;-)

- Eric LoCascio
www.FlashAnimationWebsiteDesign.com
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
Take a look at this page, which sets a test cookie, and shows some sample cookie setting code.

Call the cookie function either as a library file, like so:

:: Code ::
<script type="text/javascript" src="/js/javascript_cookies.js"></script>

Or just include the whole code block on the page, in the page <head>

Personally, I wouldn't use javascript, I'd set this server side, and do it dynamically, Javascript cookies are remarkably inelegant compared to say php cookie handling.
Back to top
Eric LoCascio
Status: New User - Welcome
Joined: 11 Dec 2007
Posts: 4
Reply Quote
Hi Jeff - thank you very much for taking the time to answer my question - I know it is probably annoying people coming in here that are clueless w/ programming asking for help, but I am kind of in a bind and your help is much appreciated. ;-)

Thanks again,
Eric
Back to top
Eric LoCascio
Status: New User - Welcome
Joined: 11 Dec 2007
Posts: 4
Reply Quote
hello - I made the changes on the cookie.js file and uploaded it. As follows...

function Set_Cookie( 'sfscookie', 'visited 9 times', 30, '/', '','' ) {


I have this in the head of the index.html page

<script type="text/javascript" src="/cookie.js"></script>

But it isn't working when I test it - what an I not getting? ;-)

Thanks you,
Eric
Back to top
jeffd
Status: Assistant
Joined: 04 Oct 2003
Posts: 594
Reply Quote
Well, to use programming, you have to do a few things: learn the basics; read sample working code; learn to test and debug. Programming is something that takes work and practice, it's not really something you can just start doing without any training.

Or you can get someone else to do it for you, your flash stuff looks pretty good.

In your case, for example, you broke the existing code completely, replaced variable parameters with hard coded parameters, so basically nothing at all will work any more.

See your sticky.
Back to top
Eric LoCascio
Status: New User - Welcome
Joined: 11 Dec 2007
Posts: 4
Reply Quote
Hi Jeff - thanks for the response. That's nice, I ruined a great script someone took hours and hours to create that quickly. ;-) Thanks for the compliment on the flash stuff - that and 3D animation are my areas, www.3dca.biz and there is constant learning with all that just to keep up, so I wish I had the time to put into learning programming, but I just don't. So I'll take your advice -what would you charge to do it... that is if you were even willing to do it. If not, is there anyone you could recommend that would implement it into the site for me? Thanks again, for your time.

-Eric[/url]
Back to top
Display posts from previous:   

All times are GMT - 8 Hours