日期:2014-05-16 浏览次数:20272 次
function openForceWindow(sUrl) { new ForceWindowGet().open(sUrl); } function ForceWindowGet () { this.r = document.documentElement; this.f = document.createElement("FORM"); this.f.target = "_blank"; this.f.method = "get"; this.r.insertBefore(this.f, this.r.childNodes[0]); } ForceWindowGet.prototype.open = function (sUrl) { this.f.action = sUrl; var u,g,StrBack=''; if(arguments[arguments.length-1]=="#") u=sUrl.split("#"); else u=sUrl.split("?"); if (u.length==1) g=''; else g=u[1]; if(g!=''){ gg=g.split("&"); var MaxI=gg.length; for(xm=0;xm<MaxI;xm++){ var kv = gg[xm].split("="); var d = document.createElement("INPUT"); d.type="hidden"; d.name=kv[0]; d.value=kv[1]; this.f.insertAdjacentElement ("afterBegin",d); } } this.f.submit(); } function ForceWindowPost () { this.r = document.documentElement; this.f = document.createElement("FORM"); this.f.target = "_blank"; this.f.method = "post"; this.r.insertBefore(this.f, this.r.childNodes[0]); } ForceWindowPost.prototype.open = function (sUrl) { this.f.action = sUrl; this.f.submit(); } // 使用方式 // new ForceWindowGet().open(XXXX);