View Full Version : javascript cookie :: "new to me"

12-23-2005, 04:18 PM
hi'all im new around here tho ive been following website abstration since 1997
even im still no-good with javascript haha

im having this problem where im really confuse about cookie setting
you see i want this "new to me" script to act upon each single item
for example http://www.sleepingforest.co.uk/cyril/videocollection

you can see that in the playlist this "new to me" is working fine to tell the user which video is new
but i don't want the "new" to go away when the page is refreshed
i want the "new" to go away only when the user is clicked on the link

obviously im ending up with a mess in a later version
i'd love to have someone telling me where i can dig in to get it up and running ;)

<title>chinese list :: video collection :: sleeping forest</title>
<meta http-equiv="Content-Type" content="text/html; charset=en-us">
<STYLE type=text/css>
body {margin-left:0; margin-right:0; margin-top:0; margin-bottom:0; width:100%;height:100%;overflow:hidden}
BODY A:visited { FONT: 8pt verdana, arial,san serif; COLOR: #ffffff; TEXT-DECORATION: none}
BODY A:link { FONT: 8pt verdana, arial,san serif; COLOR: #ffffff; TEXT-DECORATION: none}
BODY A:hover { FONT: 8pt verdana, arial,san serif; COLOR: #b4b5f0; TEXT-DECORATION: underline}
<!-- Original: Adremover (adremover@portalen.no) -->
<!-- Web Site: http://adremover.vr9.com/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// NB! You must manually change the value
// of the following adlink variable!
// Unique part of the ad link(s), i.e.,
// if the ad-link is www.myadvertiser.com,
// you can use "myadvertiser":
var adlink="chinesevideocollection";
// Time in seconds until the ads come back
// (default 24 hours):
var timeout=60*60*24;

// Do not change anything in the code below:
var showads = 1;
function adMessage(adcode) {
if (document.cookie == "") {
} else {
var the_cookie = document.cookie;
the_cookie = unescape(the_cookie);
the_cookie_split = the_cookie.split(";");
for (loop=0;loop<the_cookie_split.length;loop++) {
var part_of_split = the_cookie_split[loop];
var find_name = part_of_split.indexOf("ad");
if (find_name!=-1) {
if (find_name==-1) {
} else {
var ad_split = part_of_split.split("=");
var last = ad_split[1];
if (last!=0) {
} else {
function writeCookie(show) {
var today = new Date();
var the_date = new Date();
the_date.setTime(today.getTime() + 1000 * timeout);
var the_cookie_date = the_date.toGMTString();
var the_cookie = "ad="+show;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie = the_cookie;
function handleClick(evnt) {
var targetstring = new String(evnt.target);
if (targetstring.search(adlink) != -1) {
return true;
if (window.Event) {
window.onClick = handleClick;
// End -->
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- logo -->
<table width="202" height="314" border="0" cellpadding="0" cellspacing="0" background="./index_13.jpg">
<td width="202" height="314" align="left" valign="top">
<font face="arial" size="2" color="#ffffff">
<script language="javascript">if (showads) {document.write("<img src='./new.gif' alt='new'>")}</script><a href="./screen_chinese_stolenmobile02.shtml" onClick="writeCookie(0)" target="playscreen">小心你的手機也會這樣被偷</a><br>
<script language="javascript">if (showads) {document.write("<img src='./new.gif' alt='new'>")}</script><a href="./screen_chinese_anti-theivetutorial.shtml" onclick="writeCookie(0)" target="playscreen">警察教你如何偷車</a><br>