<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>
运行程序什么反应也没有,有谁知道,谢谢!
解决方案 »
- $(document).ready(function()在ie里不执行,ff和chrome可以执行,
- JS数组排序问题
- 如何获取其他电脑上的图片路径?
- js高手请进,100分悬赏写个传值
- google api
- javascript代码放在哪才会自动动行?
- 关于javascript的new Date()用法
- 如何用javascript调用本地的一个exe文件?
- 问一个有关js的问题 ,我的所有绑定弹出都无效 ,只有写在标签里才有效
- 用Input+Div实现类似Select的效果,定位问题,请教如何处理
- "/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>标点符号 基本都是错的,要英文状态下的标点