Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-23-2005, 03:18 PM   PM User | #1
x1024
New to the CF scene

 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
x1024 is an unknown quantity at this point
Smile javascript cookie :: "new to me"

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

Code:
<html>
<head>
<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}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
<!-- 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 == "") {
document.write(adcode);
} 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) {
break;
   }
}
if (find_name==-1) {
document.write(adcode);
} else {
var ad_split = part_of_split.split("=");
var last = ad_split[1];
if (last!=0) {
document.write(adcode);
} else {
showads=0;
         }
      }
   }
}
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;
location.reload(true);
}
function handleClick(evnt) {
var targetstring = new String(evnt.target);
if (targetstring.search(adlink) != -1) {
writeCookie(0);
}
routeEvent(evnt);
return true;
}
if (window.Event) {
window.captureEvents(Event.CLICK);
}
window.onClick = handleClick;
adMessage('');
//  End -->
</script>
</head>
<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">
	<tr>
		<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">¤p¤ß§Aªº¤â¾÷¤]·|³o¼Ë³Q°½</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¦p¦ó°½¨®</a><br>
		</font>
		</td>
	</tr>
</table>
</body>
</html>
x1024 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 08:41 PM.


Advertisement
Log in to turn off these ads.