当前位置:编程学习 > 网站相关 >>

简单js代码 设置cookie,日期,创建 dom代码

简单js代码 设置cookie,日期,创建 dom代码
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
<!-- Hide
if (top.location !== self.location) {
top.location=self.location;
}
// -->
<!-- Hide
var Sys_LoadStart=new Date();
// -->
function setCookie(name,value)
{
    var Days = 30;
    var exp  = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days*24*60*60*1000);
        document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}


function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg)) return unescape(arr[2]);
        else return null;
}

    function post(url,k,v)
    {
 var form = document.forms['whois'];
 form.target = '_blank';
        form.action = url;
        form.method = 'post';
        var ipt = document.createElement('input');
        ipt.name = k;
 ipt.type = 'hidden';
        ipt.style.display = 'none';
 ipt.value = v;
        form.appendChild(ipt);
        form.submit();
    }
</SCRIPT>

补充:网页制作,设计基础
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,