JS模拟表单提交
function Post(URL, param) { //创建form表单 var temp_form = document.createElement("form"); temp_form.action = URL; //如需打开新窗口,form的target属性要设置为'_blank' temp_form.target = "_self"; temp_form.method = "post"; temp_form.style.display = "none"; //添加参数 for (var item in param) { var opt = document.createElement("input");//添加一个input类型 opt.name = item; opt.value = param[item]; temp_form.appendChild(opt); } //提交数据 temp_form.submit(); }