//写入cookie
function
setCookie(name, value) {
var
Days = 30;
//此 cookie 将被保存 30 天
var
exp =
new
Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
document.cookie = name +
"="
+ escape(value) +
";expires="
+ exp.toGMTString();
}
///删除cookie
function
delCookie(name) {
var
exp =
new
Date();
exp.setTime(exp.getTime() - 1);
var
cval = getCookie(name);
if
(cval !=
null
) document.cookie = name +
"="
+ cval +
";expires="
+ exp.toGMTString();
}
//读取cookie
function
getCookie(name) {
var
arr = document.cookie.match(
new
RegExp(
"(^| )"
+ name +
"=([^;]*)(;|$)"
));
if
(arr !=
null
)
return
unescape(arr[2]);
return
null
;
}
//===================== cookie相关 end ======================== //
//===================== form 表单 序列化 插件 相关 beign ======================== //
var
$ = jQuery;
(
function
($){
$.fn.serializeJson=
function
(){
var
serializeObj={};
var
array=
this
.serializeArray();
var
str=
this
.serialize();
$(array).each(
function
(){
if
(serializeObj[
this
.name]){
if
($.isArray(serializeObj[
this
.name])){
serializeObj[
this
.name].push(
this
.value);
}
else
{
serializeObj[
this
.name]=[serializeObj[
this
.name],
this
.value];
}
}
else
{
serializeObj[
this
.name]=
this
.value;
}
});
return
serializeObj;
};
})(jQuery);
//===================== form 表单 序列化 插件 相关 end ======================== //
//===================== 回车触发 子页面 查询事件 相关 beign ======================== //
// 主框架页上增加 回车触发frame子页 查询动作 (仅当子页面有 .btnSearch的按钮时才触发)
jQuery(window.document).keyup(
function
(event) {
if
(event.which ==
‘13‘
) {
var
jBtn = jQuery(
".btnSearch"
);
if
(jBtn.length > 0) {
jBtn.click();
}
}
});