locked
variable screen width RRS feed

  • Question

  • User1510859543 posted

    We want to be able to open a new window that is 80% of the opener window.  We have a function below to do this but it opens it full screen.  What am I missing?

            function openparts() {
                var sheight = $(window).height();   // returns height of browser viewport
                var swidth = $(window).width();
                swidth = (swidth * .8);
                //get server ip address held in hidden textbox
                var varip = document.getElementById('txtsrvip').value;
                var sappurl = 'http://' + varip + '/RepairTrak/tables/PartsInventory.aspx?rid=0';
                var sopts = 'height=600,width=' + swidth;
                sopts += ',status=1,toolbar=0,menubar=0,location=0,resizable=1';
                var ws1 = window.open(sappurl, '_blank,' + sopts);
                ws1.focus();
                return false;
            }

    Monday, October 8, 2018 5:43 PM

Answers

  • User-893317190 posted

    Hi dlchase,

    You put the comma inside the single quote.Please move it outside the single quote and remove the plus.

    function openparts() {
                var sheight = $(window).height();   // returns height of browser viewport
                var swidth = $(window).width();
                swidth = (swidth * .2);
                //get server ip address held in hidden textbox
          
                 var sappurl = 'http://' + varip + '/RepairTrak/tables/PartsInventory.aspx?rid=0';
                var sopts = 'height=600,width=' + swidth;
                sopts += ',status=1,toolbar=0,menubar=0,location=0,resizable=1';
                var ws1 = window.open(sappurl, '_blank',sopts);
                ws1.focus();
                return false;
            }

    Best regards,

    Ackerly Xu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 9, 2018 1:44 AM