Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
I have this javascript and need a little help to set it up
Old 03-25-2009, 11:50 PM I have this javascript and need a little help to set it up
Junior Talker

Posts: 1
Name: beto romero
Trades: 0
Hi... i hope you can help me... thanks in advanced...

I have to sites, one in english and the other one in spanish, I want to set up a javascript code that when a user hits an achor text on mainsite.com links the user to secondsite.com and at the same time create a cookie that every time that that user types mainsite.com the cookie redirects the user to secondsite.com

I have this code... the problem is...

<script type="text/javascript">



<!--
/* Copyright http://www.perlscriptsjavascripts.com
Free and commercial Perl and JavaScripts */

function SetCookie(Name, Value){
document.cookie = Name + "="+escape(Value)+";expires="+ged(1);
}

// page to go to if cookie exists
var go_to = "http://www.enhibarrio.ning.com";
//name for this page's cookie. Make sure each page has a differnt one
var thisCookie="clicked1";

// number of days cookie lives for
num_days = 1;
function ged(noDays) {
var today = new Date();
var expr = new Date(today.getTime() + noDays*24*60*60*1000);
return expr.toGMTString();
}

function readCookie(cookieName){
var start = document.cookie.indexOf(cookieName);
var cookieval=unescape(document.cookie.substring((star t+cookieName.length+1), document.cookie.indexOf(";", start)));
if(start>=0) { //then the cookie existed
window.location=go_to;
} else {
//do nothing
}
}

readCookie(thisCookie);
// -->



</script>


<span onclick="SetCookie(thisCookie, 'yes')">
</span>
<div align="center"><span onclick="SetCookie(thisCookie, 'yes')"><a href="http://www.enhibarrio.ning.com" target="_blank"><img src="http://api.ning.com/files/zCIZRipVEcAxFL27yTWvAY2M0p*IgZiMQm3hBAwf40EsgTXYJA wjD2xO2Q8AkPHyKpQr1VULEDiyj6n*ng8KfIt78wENm8j0/entraralblog.png" width="480" height="60" border="0" /></a></span></div>
<span onclick="SetCookie(thisCookie, 'yes')">
</span>


but the problem is that i want them to be able to come back to mainsite if they dont like secondsite.com, i need the code to expire the cookie if they want to come back to mainsite.com...
HiBarrio.com is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-26-2009, 09:26 AM Re: I have this javascript and need a little help to set it up
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,520
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
two different sites CANNOT share cookies.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to I have this javascript and need a little help to set it up
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18334 seconds with 12 queries