本文总共有 15 条评论,现在显示最新的 5 条。暂时没有人参与评分 220.162.214.96 Publish at 2004-7-3 12:19:52 怎么样才能使 一打开网业就有音乐啊?? 还有那什么CSS怎么都看不懂啊 谁帮帮我 ?QQ227585359 谢谢!!!!!!! 218.27.87.150 Publish at 2004-5-30 15:51:11 —→首页—→网页建设其它相关—→正文 智慧型”网页制作技巧 人们都希望自己的主页生动活泼,并且多一些与访问者的交互。下面的小技巧是否能让你感到自己的网页多了几分色彩呢? 1.来访者访问次数的记录
一位来访者看到我能统计他访问我的主页的次数时,非常惊讶,他在留言簿里问我是不是发了黑客程序给他,其实就是下面这段小程序(见程序1)。
<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<=4000) document.cookie=curCookie else if (confirm("Cookie exceeds 4KB and will be cut!")) document.cookie=curCookie } function getCookie(name) { var prefix = name + "=" var cookieStartIndex=document.cookie.indexOf(prefix) if (cookieStartIndex == -1) return null var cookieEndIndex=document.cookie.indexOf(";",cookieStartIndex+prefix.length) if (cookieEndIndex == -1) cookieEndIndex=document.cookie.length return unescape(document.cookie.substring(cookieStartIndex+prefix.length, cookieEndIndex)) } function deleteCookie(name, path, domain) { if (getCookie(name)) { document.cookie=name+"="+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+";expires=Thu,01-Jan-70 00:00:01 GMT" } } function fixDate(date) { var base = new Date(0) var skew = base.getTime() if (skew > 0) date.setTime(date.getTime()-skew) } var now = new Date() fixDate(now) now.setTime(now.getTime()+365*24*60*60*1000) var visits = getCookie("counter") if (!visits) visits = 1 else visits = parseInt(visits) + 1 setCookie("counter", visits, now) document.write("我想您是第"+visits+"次来这儿了!很高兴又见到你噢^_^!") / --> </script> (程序1)
2.可以根据时间变化的欢迎词
下面这段小程序能够根据访问者来访的时间的不同而致以不同的欢迎词(见程序2)。
<script language="Javascript"> <!-- Hiding var now = new Date() var year=now.getYear() var month=now.getMonth()+1; var date= now.getDate() var time = now.getHours() if (time>=0) {var hello="你真是个夜猫子!这么晚了还在闲逛,你知道吗?"} if (time>=6) {var hello="现在还是挺早的,"} if (time>=9) {var hello="小心老板哦,"} if (time>=12) {var hello="中午好呀!"} if (time>13) {var hello="中午睡觉了吗?"} if (time>=18) {var hello="吃晚饭了吗?"} if time>19) {var hello="怎么没看电视?"} if (time>23) {var hello="已经很晚了,还不去睡觉?你知道不?"} var hour1=(now.getHours() >=10)?"":"0" var m2=(now.getMinutes()>=10)?"":"0" var t=(now.getHours()>12)?now.getHours()-12:now.getHours() var r2 = (t >= 10) ? "" : "" var color=(now.getSeconds()%2==0)?"ffff80":"00000f" dcument.write("<font color=\"#",color,"\">",hello,"现在是北京时间:19",year,"年",month,"月",date,"日,",hour1,now.getHours(),"点",m2,now.getMinutes(),"分",((now.getSeconds()<10)?"0":"")+now.getSeconds(),"秒了","</font>") timerRunning=true //end hiding contents --> </script> (程序2)
看到这么亲切的问候词,你的访问者一定会多一份对你网页的关心和呵护。 3.访问者所使用的浏览器版本的确定
<script> document.write("您现在用的是"+navigator.appName+""+navigator.appVersion+"版的浏览器,我猜对了吗?开个玩笑,无论对错,真的很希望您能经常来呦!") </script>
把这些小程序加到你的网页中试试看,有什么问题可以写信告诉我,地址是 doggy007@188.net。 文章资料(滕伟 滕彬 "技巧驿站" 收集) 关闭当前窗口
61.146.126.202 Publish at 2004-5-22 20:32:24 ok2 202.96.126.146 Publish at 2004-5-21 14:06:00 看不懂,。。。苦啊 221.233.97.179 Publish at 2004-5-2 8:42:06 好,说的好啊!经典!最常用的几个都说了
查看全部评论 |