0

How can I disable the parent window and have the focus only the popup with the below code?

<body onFocus="parent_disable();" onclick="parent_disable();">
<div class="login-box">
  <form action="post" class="login-form">
    <div class="form-group">
      <label for="user-name">Username:</label>
      <input id="user-name" type="text" name="user" required>
    </div>
    <div class="form-group">
      <label for="password">Password:</label>
      <input id="password" type="password" name="password">
    </div>
    <div class="button-container text-right">
      <button class="btn btn-default" type="button" id="btn-cancel">Cancel</button>
      <button class="btn btn-primary" type="button" id="btn-login">Login</button>
    </div>
  </form>
  <a href="ForgotPassword.html" onclick="return popup(this, 'Signup')">Forgot password</a>
  <p>Don't have an account? <a href="javascript:child_open()" >Sign up</a> here</p>
</div>

<script type="text/javascript">
    var popupWindow=null;
    function child_open(){ 
        popupWindow =window.open('Signup.jsp',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");
    }
    function parent_disable() {
        if(popupWindow && !popupWindow.closed)
        popupWindow.focus();
    }
</script>
</body>

I have tried some suggestions from stackover flow but none of them are useful for me.Please someone help in resolving this.

Ali Zia
  • 3,825
  • 5
  • 29
  • 77
Rahul
  • 759
  • 3
  • 21
  • 43
  • 1
    Possible duplicate of [how to make window.open pop up Modal?](http://stackoverflow.com/questions/24801124/how-to-make-window-open-pop-up-modal) – Ted Nyberg Mar 21 '16 at 07:57
  • It's not working for me. :( – Rahul Mar 21 '16 at 12:20
  • @G.L.P.. can you please help me in resolving this.. – Rahul Mar 24 '16 at 07:36
  • 1
    `function child_open() { popupWindow =window.open('Signup.jsp',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200"); popupWindow.focus(); }` – a45b Mar 24 '16 at 07:42
  • Thanks alot :) 60% of the issue is resolved....just now observed that , user is allowed to click on the links in the parent window. only he is not allowed to enter data in the text box....any solution for this... – Rahul Mar 24 '16 at 07:51
  • also, please let me know how can I make the popup position fixed..as of now, am able to drag it here and there .. :( – Rahul Mar 24 '16 at 07:56

0 Answers0