html 表单提交 地址栏 显示"=%cc%ed%bc%d3 ",的JavaScript:使用JavaScript填写HTML表单并提交...

Abc

Def

我需要使用JavaScript来填充它,并将其发送。

我所著:

function post(path) {

method = "post";

var form = document.createElement("form");

form.setAttribute("method", method);

form.setAttribute("action", path);

var hiddenField = document.createElement("input");

hiddenField.setAttribute("type", "radio");

hiddenField.setAttribute("name", "option_id");

hiddenField.setAttribute("value", "12");

hiddenField.setAttribute("type", "hidden");

hiddenField.setAttribute("name", "poll_id");

hiddenField.setAttribute("value", "56");

form.submit();

}

post('http://www.example.net/index.php');

但在回答有没有数据。我需要发送表格Abc = value='12'。表单操作不在我的域名上。我有a.com,表格是b.com。

# nc -l 192.168.1.11 -p 80

POST /index.php HTTP/1.1

Host: example.net

Connection: keep-alive

Content-Length: 0

Cache-Control: max-age=0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8

Origin: null

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36

Content-Type: application/x-www-form-urlencoded

Accept-Encoding: gzip,deflate

Accept-Language: cs-CZ,cs;q=0.8

我做得不好?

2014-10-17

martin

+0

看起来您忘记将隐藏字段添加到表单中,并将表单追加到文档中。 –

2014-10-17 13:56:40

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值