我正在使用两个参数进行表单提交,并在新窗口中打开响应,如
<html>
<a href="#" onclick="generateandpost()">Click Here</a>
<script>
function generateandpost(){
var params = [
'height='+screen.height,
'width='+screen.width,
'fullscreen=yes'
].join(',');
var form = document.createElement("form");
form.setAttribute("method", "post");
form.setAttribute("target", "_blank");
form.setAttribute("action", "http://myurl.com");
// setting form target to a window named 'formresult'
form.setAttribute("target", "formresult");
var hiddenField = document.createElement("input");
var mapInput = document.createElement("input");
mapInput.type = "hidden";
mapInput.name = "empid";
mapInput.value = '756746574';
form.appendChild(mapInput);
var mapInput1 = document.createElement("input");
mapInput1.type = "hidden";
mapInput1.name = "moduleid";
mapInput1.value = '457646574';
form.appendChild(mapInput1);
document.body.appendChild(form);
window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
form.submit();
}
</script>
</html>
当目标窗口打开时,它没有最大化。我希望最大化的窗口应该是打开的,所以我使用的是height
和width
,但目标窗口仍在小窗口中打开。
请告诉我我错过了什么。