赞助连接

赞助连接

阅 读 文 章

请问这段javascript为啥会“object expected”出错呢?

[来源:网上转载 (http://bbs.chinaunix.net) | 作者:网友(网络转载) | 时间:2008-08-08 | 浏览: 人次 ]

代 *** 如下:
<html>
<head><title>The Cookie</title>
</head>
<script language="javacript">
        function creatCookie(form){
                var when=new Date();
                when.setTime(when.getTime()+24*60*60*1000);
                when.setfullyear(when.getfullyear()+1);
                yname=form.yourname.value;
                rpasswd=form.passwd.value;
                document.cookie=encodeURI("name")+"="+encodeURI(yname)
                +";expires="+when.toGMTString();
                document.cookie=encodeURI("passwd")+"="+encodeURI(ypasswd)
                +";expires="+when.toGMTString();
                alert(document.cookie);
        }
        function welcome(myform){
                you=myform.yourname.value;
                var position=document.cookie.indexof("name=");
                if(position!=-1){
                        var begin=position+5;
                        var end=document.cookie.indexof(";",begin);
                        if(end==-1){end=document.cookie.length;}
                        you=decodeURI(document.cookie.substring(begin,end));
                        str=you;
                        alert("Welcome! "+you);
                }else{
                        alert("You don't have a cookie!");
                }
        }
</script>
<body bgcolor="lightgrey">

TAG标签 : 请问 var encodeURI you end document.cookie begin alert

最新评论 共有0位网友发表了评论

发表评论

评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名:(注册)
密码:
验证码:
匿名发表
网站地图友情连接交流论坛网站投稿广告服务联系我们留言本站长统计
Some rights reserved: www.newhtm.com, 鄂ICP备07010232号 E-mail:chinakafei@live.com,QQ:552766
中国咖啡技术网(Chmhome):国外编程技术书籍,中文编程手册,经典编程文章,交流技术,技术软件下载,计算机论文,毕业论文.