javascript动态创建Form表单和表单项,然后提交表单请求,最后删除表单,代码片段如下(Firefox测试通过):
var dlform = document.createElement('form');
dlform.style="display:none;";
dlform.method='post';
dlform.action='../fileServlet';
dlform.target='callBackTarget';
var hdnFilePath = document.createElement('input');
hdnFilePath.type = 'hidden';
hdnFilePath.name = 'filePath';
hdnFilePath.value = filePath;
dlform.appendChild(hdnFilePath);
document.body.appendChild(dlform);
dlform.submit();
document.body.removeChild(dlform); <end>
本文介绍如何使用JavaScript动态创建Form表单及表单项,并实现表单提交。此外,还提供了删除表单的方法。代码已在Firefox中测试通过。
1387

被折叠的 条评论
为什么被折叠?



