如何通过Post数据实现点击后自动打开新网页的功能?

2026-04-06 10:391阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计114个文字,预计阅读时间需要1分钟。

如何通过Post数据实现点击后自动打开新网页的功能?

在新页面中发送Post数据,例如:`post('ExportImg.ashx', { imgdata: Data });`

如何通过Post数据实现点击后自动打开新网页的功能?

函数post用于发送数据:javascriptfunction post(URL, PARAMS) { var temp_form=document.createElement(form); temp_form.action=URL; temp_form.target=_blank; temp_form.method=post;

在新打开的页面中Post数据

例子: post('ExportImg.ashx', { "imgdata": Data });

function post(URL, PARAMS) { var temp_form = document.createElement("form"); temp_form.action = URL; temp_form.target = "_blank"; temp_form.method = "post"; temp_form.style.display = "none"; for (var x in PARAMS) { var opt = document.createElement("textarea"); opt.name = x; opt.value = PARAMS[x]; temp_form.appendChild(opt); } document.body.appendChild(temp_form); temp_form.submit(); }

本文共计114个文字,预计阅读时间需要1分钟。

如何通过Post数据实现点击后自动打开新网页的功能?

在新页面中发送Post数据,例如:`post('ExportImg.ashx', { imgdata: Data });`

如何通过Post数据实现点击后自动打开新网页的功能?

函数post用于发送数据:javascriptfunction post(URL, PARAMS) { var temp_form=document.createElement(form); temp_form.action=URL; temp_form.target=_blank; temp_form.method=post;

在新打开的页面中Post数据

例子: post('ExportImg.ashx', { "imgdata": Data });

function post(URL, PARAMS) { var temp_form = document.createElement("form"); temp_form.action = URL; temp_form.target = "_blank"; temp_form.method = "post"; temp_form.style.display = "none"; for (var x in PARAMS) { var opt = document.createElement("textarea"); opt.name = x; opt.value = PARAMS[x]; temp_form.appendChild(opt); } document.body.appendChild(temp_form); temp_form.submit(); }