Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Disable parent window while child window is opened using javascript??

    1. I have a parent window named worklist.jsp
    2. Parent window has a button. on click of the button, it calls a function named getEventLogUser().
    3. getEventLogUser() function in turns calls a function named popupWindowWithPost() which opens the child window. both the function is in separate js file(utility.js)..
    4. My need is, i have to disable the parent window when child is opened.

    worklist.jsp:

    Code:
     <div class="claro" id="menuDiv21" onclick="setWidgetproperty(this.id,'x','navMenu21');" onmousedown="setMenuBarProperty('navMenu21');" onmouseup="setDocStyle(this.id)" style="border:1px dotted white; left: auto; position: absolute; top: 620px;">
             <div dojotype="dijit.MenuBar" id="navMenu21" style="font-size:11pt;" title="MenuBar">
                  <div dojotype="dijit.MenuBarItem" id="SearchMenu21" onclick="getEventLogUser();setMenuId(this.id);" style="font-size:11pt;" title="menuBarItem">
                       <img class="images" id="SearchMenu21" name="search5.png" onclick="setImgProperty(this.id)" src="images/uploads/search.png" style="height:20px; width:20px;">
                       Search
                  </div>
        </div>
        </div>
    utility.js:

    Code:
    function getEventLogUser(){
        		var dummyvar = document.getElementById("CWPROCESSEVENTLOG.OBJECT_ID").value;
        		popupWindowWithPost("eventLogUser.jsp",'height=600px,width=960px,top=50px,left=150px,scrollbars=no,sizable=yes,toolbar=no,statusbar=no','processManager',dummyvar);
        }
        function popupWindowWithPost(url, windowoption, name, params)
        {
                 var form = document.createElement("form");
                 form.setAttribute("method", "post");
                 form.setAttribute("action", url);
                 form.setAttribute("target", name);
                 var input = document.createElement('input');
                 input.type = 'hidden';
                 input.name = "PARAM";
                 input.value = params;
                 form.appendChild(input);
        		 document.body.appendChild(form);
                 window.open(url, name, windowoption);
        		 form.submit();
                 document.body.removeChild(form);
        }

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Each window is completely independent - the only way to do what you want is to put both in the same window.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Dec 2012
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts
    its not necessary to have it in same window... i achieved it from this link..
    http://www.aspsnippets.com/Articles/...avaScript.aspx

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,639
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Quote Originally Posted by BobbyRachel View Post
    its not necessary to have it in same window... i achieved it from this link..
    http://www.aspsnippets.com/Articles/...avaScript.aspx

    JavaScript has changed significantly since 2009 when that script was written. Most of the browsers that allowed that script to work are now long dead.

    The modal setting in that script is ignored by some browsers and can be overridden in most others. Many browsers even allow you to specifically direct window.open calls to another tab in the same window so that making that modal becomes meaningless.

    The only way to ensure that it is not easily bypassed or blocked is to do it all within the one window.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •