【发布时间】:2011-08-26 12:16:40
【问题描述】:
我想提交一个带有来自 prompt() 函数的自定义变量的表单。
提交表单使用代码
document.formname.submit();
但这只会提交表单,我想要的是:
var iInvoiceID = prompt("Please enter the invoice ID");
document.formname.submit(); // But it should send iInvoiceID within $_POST aswell
一种方法可能是:在提示后,将输入类型 = 'hidden' 设置为iInvoiceID 的值,然后提交表单。但是有没有更好/更清洁的方法来做到这一点?
【问题讨论】:
标签: php javascript