<script language=Javascript″>
<!--
var username = getcookie(′username′);
if (username == null) {
username = prompt(′please enter your name (otherwise press cancel)′,″″);
if (username == null) {
alert(′its ok if you dont want to tell me your name′);
username = ′websurfer′;
} else {
// don′t set the username cookie.... because the user refused to tell you.
// they will be prompted next time....
pathname = location.pathname;
mydomain = pathname.substring(0,pathname.lastindexof(′/′)) +′/′;
// set expiry date to 1 year from now.
var largeexpdate = new date ();
largeexpdate.settime(largeexpdate.gettime()+(365*24*3600*1000));
setcookie(′username′,username,largeexpdate,mydomain); } }
function getcookieval (offset) {
var endstr = document.cookie.indexof (″;″, offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); }
function getcookie (name) {
var arg = name + ″=″;
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j)==arg)
return getcookieval (j);
i = document.cookie.indexof(″ ″, i) + 1;
if (i == 0)
break;
} return null; }
function setcookie (name, value) {
var argv = setcookie.arguments;
var argc = setcookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + ″=″ + escape (value)+((expires == null) ? ″″ : (″; expires=″+expires.togmtstring()))+((path == null) ? ″″ : (″; path=″ + path))+((domain == null) ? ″″ : (″; domain=″ + domain))+((secure == true) ? ″; secure″ : ″″);
}
document.write(′<p>谢谢光临, ′+username);
//
--></script>
运行程序什么反应也没有,有谁知道,谢谢!
<!--
var username = getcookie(′username′);
if (username == null) {
username = prompt(′please enter your name (otherwise press cancel)′,″″);
if (username == null) {
alert(′its ok if you dont want to tell me your name′);
username = ′websurfer′;
} else {
// don′t set the username cookie.... because the user refused to tell you.
// they will be prompted next time....
pathname = location.pathname;
mydomain = pathname.substring(0,pathname.lastindexof(′/′)) +′/′;
// set expiry date to 1 year from now.
var largeexpdate = new date ();
largeexpdate.settime(largeexpdate.gettime()+(365*24*3600*1000));
setcookie(′username′,username,largeexpdate,mydomain); } }
function getcookieval (offset) {
var endstr = document.cookie.indexof (″;″, offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); }
function getcookie (name) {
var arg = name + ″=″;
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j)==arg)
return getcookieval (j);
i = document.cookie.indexof(″ ″, i) + 1;
if (i == 0)
break;
} return null; }
function setcookie (name, value) {
var argv = setcookie.arguments;
var argc = setcookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + ″=″ + escape (value)+((expires == null) ? ″″ : (″; expires=″+expires.togmtstring()))+((path == null) ? ″″ : (″; path=″ + path))+((domain == null) ? ″″ : (″; domain=″ + domain))+((secure == true) ? ″; secure″ : ″″);
}
document.write(′<p>谢谢光临, ′+username);
//
--></script>
运行程序什么反应也没有,有谁知道,谢谢!
解决方案 »
- javascript prototype 问题,我理解的不是很深刻
- ASP登录跳转至中间页出现蓝屏问题!
- 怎么实现WEB的拖拉啊.就像GOOGLE上面一上.
- 如何用angular实现childRouter的功能?
- java小程序不能执行,请问要安装什么软件?
- 外部链接JS的问题
- javascript怎么比较对象?(里面有代码,请大家看看!)
- 如何让一个列表框的选定的值,添加到另一个列表框中
- 日期问题,什么函数世日期增加或减少一天
- 想学习activex在ie方面的应用,该怎么入门,最好能介绍一些可供下载的资料,谢谢!!
- "/Date(1333245600000+0800)/" js里面怎么让它显示YYYY-MM-DD
- a打开b从b传值去回a,b打开c同时传值去c【急急急】
<!--
var username = getcookie(′username′);
if (username == null) {
username = prompt(′please enter your name (otherwise press cancel)′,″″);
if (username == null) {
alert(′its ok if you dont want to tell me your name′);
username = ′websurfer′;
} else {
// don′t set the username cookie.... because the user refused to tell you.
// they will be prompted next time....
pathname = location.pathname;
mydomain = pathname.substring(0,pathname.lastindexof(′/′)) +′/′;
// set expiry date to 1 year from now.
var largeexpdate = new date ();
largeexpdate.settime(largeexpdate.gettime()+(365*24*3600*1000));
setcookie(′username′,username,largeexpdate,mydomain); } }
function getcookieval (offset) {
var endstr = document.cookie.indexof (″;″, offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); }
function getcookie (name) {
var arg = name + ″=″;
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j)==arg)
return getcookieval (j);
i = document.cookie.indexof(″ ″, i) + 1;
if (i == 0)
break;
} return null; }
function setcookie (name, value) {
var argv = setcookie.arguments;
var argc = setcookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + ″=″ + escape (value)+((expires == null) ? ″″ : (″; expires=″+expires.togmtstring()))+((path == null) ? ″″ : (″; path=″ + path))+((domain == null) ? ″″ : (″; domain=″ + domain))+((secure == true) ? ″; secure″ : ″″);
}
document.write(′<p>谢谢光临, ′+username);
//
--></script>标点符号 基本都是错的,要英文状态下的标点