我正在使用两个参数提交表单,并且响应正在新窗口中打开,例如
<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
目标窗口仍然在小窗口中打开。
请告诉我我错过了什么。