javascript 读取,设置cookies
function SetCookie(name,value){
var argv=SetCookie.arguments;
var argc=SetCookie.arguments.length;
var expires=(2<argc)?argv[2]:null;
var path=(3<argc)?argv[3]:null;
var domain=(4<argc)?argv[4]:null;
var secure=(5<argc)?argv[5]:false;
document.cookie=name+"="+escape(value)+((expires==null)?"":(";
expires="+expires.toGMTString()))+((path==null)?"":(";
path="+path))+((domain==null)?"":(";
domain="+domain))+((secure==true)?"; secure":"");
}
function GetCookie(Name) {
var search = Name + "=";
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset,end));
}
}
return returnvalue;
}
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
打开一个 js 文件,编辑完成保存时,突然提醒下面的错误:
Save could not be completed.
Reason:
Some characters cannot be mapped using “ISO-8859-1″ character encoding. Either change the encoding or remove the characters which are not supported by the “ISO-8859-1″ character ......
1、无提示关闭窗口
<input type="button" onClick="window.opener = '';window.close();" value="IE6最简单的无提示关闭窗口" >
2、防止被人iframe
if (top.location != self.location)
{
top.location.href="http://www.34do.net";
}
3、判断一个对象存在不存在
document.all("a")==null(不存在)
......
String
字符串对象。声明一个字符串对象最简单、快捷、有效、常用的方法就是直接赋值。
属性
length
用法:<字符串对象>.length;返回该字符串的长度。
方法
......