指引网

当前位置: 主页 > 网页制作 > WEB开发 >

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

来源:网络 作者:佚名 点击: 时间:2017-07-19 00:33
[摘要] 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 set


<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>

------分隔线----------------------------