使用javascript jQuery重新调整子窗口大小

时间:2013-09-11 12:16:56

标签: javascript jquery ajax

我正在使用两个参数进行表单提交,并在新窗口中打开响应,如

<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>

当目标窗口打开时,它没有最大化。我希望最大化的窗口应该是打开的,所以我使用的是heightwidth,但目标窗口仍在小窗口中打开。

请告诉我我错过了什么。

0 个答案:

没有答案