js模拟表单提交
postcall( '/index.php', { UserName: 'UserName', }); function postcall( url, params, target){ var tempform = document.createElement("form"); tempform.action = url; tempform.method = "post"; tempform.style.display="none" if(target) { tempform.target = target; } for (var x in params) { var opt = document.createElement("input"); opt.name = x; opt.value = params[x]; tempform.appendChild(opt); } var opt = document.createElement("input"); opt.type = "submit"; tempform.appendChild(opt); document.body.appendChild(tempform); tempform.submit(); document.body.removeChild(tempform); } 本作品采用《CC 协议》,转载必须注明作者和本文链接
关于 LearnKu
哈哈 以前写过一个postOpen