日期:2014-05-16 浏览次数:20358 次
/**
* 提交表单,隐藏url中的参数,替换掉location.href = action?param1=1¶m2=10
* url 跳转的Action
* params数组,数组中每个对象需要有两个属性 key和value 分别对应Action中传递的参数名和对应的值
* 使用样例:
* var params = [];
* var param1 = {};
* param1.key = "param1";
* param1.value = 100;
* var param2 = {};
* param2.key = "param2";
* param2.value = 200;
* params.push(param1);
* params.push(param2);
* formJumpFun("myAction", params);
*/
function formJumpFun(url, params, target){
var muyeForm = document.createElement("form");
muyeForm.method="post" ;
muyeForm.action = url;
if(target == "_blank"){
muyeForm.target = target;
}
for(var i = 0; i < params.length; i++){
var paramTmp = params[i];
var inputTmp = document.createElement("input") ;
inputTmp.setAttribute("name", paramTmp.key) ;
inputTmp.setAttribute("value", paramTmp.value);
muyeForm.appendChild(inputTmp) ;
}
document.body.appendChild(muyeForm);
//TODO IE有点问题
// if(target != undefined && target != null){
// muyeForm.target = target;
// if(target != "_blank"){
// window.open("about:blank", target ,'status=yes,toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=600,height=400,top=0,left=220');
// }
// }
muyeForm.submit();
document.body.removeChild(muyeForm);
};
//====================================================一下公共校验函数
function get_Cookie(name) {
var start = document.cookie.indexOf(name + '=');
var len = start + name.length + 1;
if ((!start) && (name != document.cookie.substring(0, name.length)))
return null;
if (start == -1)
return null;
var end = document.cookie.indexOf(';', len);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(len, end));
}
function set_Cookie(name, value, expires) {
var today = new Date();
today.setTime(today.getTime());
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date(today.getTime() + (expires));
document.cookie = name + "=" + escape(value)
+ ((expires) ? ";expires=" + expires_date.toGMTString() : "");
}
function delete_Cookie(name, path, domain) {
if (Get_Cookie(name)) {
document.cookie = name + '=' + ';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
}
var languageSet = "languageSet";
var sysLan = get_Cookie(languageSet);
if (null == sysLan) {
sysLan = "zh";
}
function getLanguage(language) {
sysLan = language;
}
var wakeMsg1;
var wakeMsg2;
var wakeMsg3;
var wakeMsg4;
var wakeMsg5;
var wakeMsg6;
var wakeMsg7;
var wakeMsg8;
var wakeMsg9;
var wakeMsg10;
var wakeMsg11;
var wakeMsg12;
var wakeMsg13;
var wakeMsg14;
var wakeMsg15;
var wakeMsg16;
var wakeMsg17;
var usrCheckMsg1 = "只能为字母开头,由字母、数字或下划线组成!";
var usrCheckMsg2 = "长度不能小于3!";
var usrCheckMsg3 = "长度不能大于20!";
var usrCheckMsg4 = "