知识大全 用JavaScript查看一些用户信息
Posted 知
篇首语:会当凌绝顶,一览众山小。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 用JavaScript查看一些用户信息相关的知识,希望对你有一定的参考价值。
用JavaScript查看一些用户信息 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!
检测浏览器版本 <Script Language= JavaScript > <! document write(navigator appVersion) // > </script> 记住来访次数 <SCRIPT LANGUAGE= JavaScript > <! var caution = false function setCookie(name value expires path domain secure) var curCookie = name + = + escape(value) + ((expires) ? ; expires= + expires toGMTString() : ) + ((path) ? ; path= + path : ) + ((domain) ? ; domain= + domain : ) + ((secure) ? ; secure : ) if (!caution || (name + = + escape(value)) length <= ) okie = curCookie else if (confirm( Cookie exceeds KB and will be cut! )) okie = curCookie function getCookie(name) var prefix = name + = var cookieStartIndex = okie indexOf(prefix) if (cookieStartIndex == ) return null var cookieEndIndex = okie indexOf( ; cookieStartIndex + prefix length) if (cookieEndIndex == ) cookieEndIndex = okie length return unescape(okie substring(cookieStartIndex + prefix length cookieEndIndex)) function deleteCookie(name path domain) if (getCookie(name)) okie = name + = + ((path) ? ; path= + path : ) + ((domain) ? ; domain= + domain : ) + ; expires=Thu Jan : : GMT function fixDate(date) var base = new Date( ) var skew = base getTime() if (skew > ) date setTime(date getTime() skew) var now = new Date() fixDate(now) now setTime(now getTime() + * * * * ) var visits = getCookie( counter ) if (!visits) visits = else visits = parseInt(visits) + setCookie( counter visits now) document write( 您已来这儿 + visits + 次 ) // > </SCRIPT> 你从哪个网页访问过来 <Script Language= JavaScript > document write(document referrer) </SCRIPT> 最后更新日期 <script language= JavaScript > <! hide script from old browsers document write( This page has been updated: + document lastModified + ) // end hiding > </script> 输入姓名至欢迎词 把以下代码放在<head></head>之间 <script> var name=prompt( YOUR PROMPT MESSAGE ANY INITAL VALUE ) </script> </font> 把以下代码放在HTML文件中 <center> <font color=green> <script>document write(name);</script> </font> 其它要输出信息 </center> </font> 记住来访时间 <HTML> <HEAD> <TITLE>Name Visits Last Visit</TITLE> <SCRIPT LANGUAGE= JavaScript > <! Begin var expDays = ; var exp = new Date(); exp setTime(exp getTime() + (expDays* * * * )); function Who(info) var VisitorName = GetCookie( VisitorName ) if (VisitorName == null) VisitorName = prompt( 您的尊姓大名 ); SetCookie ( VisitorName VisitorName exp); return VisitorName; function When(info) var rightNow = new Date() var WWHTime = ; WWHTime = GetCookie( WWhenH ) WWHTime = WWHTime * var lastHereFormatting = new Date(WWHTime); var intLastVisit = (lastHereFormatting getYear() * )+ (lastHereFormatting getMonth() * ) + lastHereFormatting getDate() var lastHereInDateFormat = + lastHereFormatting; var dayOfWeek = lastHereInDateFormat substring( ) var dateMonth = lastHereInDateFormat substring( ) var timeOfDay = lastHereInDateFormat substring( ) var year = lastHereInDateFormat substring( ) var WWHText = dayOfWeek + + dateMonth + at + timeOfDay SetCookie ( WWhenH rightNow getTime() exp) return WWHText function Count(info) var WWHCount = GetCookie( WWHCount ) if (WWHCount == null) WWHCount = ; else WWHCount++; SetCookie ( WWHCount WWHCount exp); return WWHCount; function set() VisitorName = prompt( Who are you? ); SetCookie ( VisitorName VisitorName exp); SetCookie ( WWHCount exp); SetCookie ( WWhenH exp); function getCookieVal (offset) var endstr = okie indexOf ( ; offset); if (endstr == ) endstr = okie length; return unescape(okie substring(offset endstr)); function GetCookie (name) var arg = name + = ; var alen = arg length; var clen = okie length; var i = ; while (i < clen) var j = i + alen; if (okie substring(i j) == arg) return getCookieVal (j); i = okie indexOf( i) + ; if (i == ) break; return null; function SetCookie (name value) var argv = SetCookie arguments; var argc = SetCookie arguments length; var expires = (argc > ) ? argv[ ] : null; var path = (argc > ) ? argv[ ] : null; var domain = (argc > ) ? argv[ ] : null; var secure = (argc > ) ? argv[ ] : false; okie = name + = + escape (value) + ((expires == null) ? : ( ; expires= + expires toGMTString())) + ((path == null) ? : ( ; path= + path)) + ((domain == null) ? : ( ; domain= + domain)) + ((secure == true) ? ; secure : ); function DeleteCookie (name) var exp = new Date(); exp setTime (exp getTime() ); var cval = GetCookie (name); okie = name + = + cval + ; expires= + exp toGMTString(); // End > </SCRIPT> </HEAD> <BODY BGCOLOR=#ffffff vlink=# ff> <! Demonstration > <CENTER> <SCRIPT LANGUAGE= JavaScript > if (Count()== ) document write( 您好! + Who() + 您首次来这儿 请多提宝贵意见 ); else document write( 您好! + Who() + 您已来这儿 + Count() + 次了 最后一次在 + When() + ); </SCRIPT> </CENTER> </BODY> </HTML> cha138/Article/program/Java/Javascript/201311/25300相关参考
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>>//tracklinktechcn/?m_i
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>>//tracklinktechcn/?m_i
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>>//tracklinktechcn/?m_i
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>>//tracklinktechcn/?m_i
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>>//tracklinktechcn/?m_i
——此文章摘自《ASPNET+SQLServer网络应用系统开发案例精解》定价¥ 特价¥详细>> &nbs
用Javascript评估用户输入密码的强度 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!&nbs
做网页的朋友都会遇到这种情况有时自己辛苦半天做的网页尤其是一些JavaScript特效很容易被人利用查看源文件而复制那么如何才能防止被人查看源代码呢?我们可以利用eventbutton特性来做到下表是
PHP网络编程:用Session保存用户信息 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!&nbs
用JavaScript实现一些随机事件 以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!随机广告<