Window popUp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mike1961
    New Member
    • Apr 2008
    • 66

    Window popUp

    Hi everyone.

    I have problem with this function javascript:

    Code:
    var popup = null;
     
    function OpenPopup(fld, tbl, col, w, h)
    {
      var pw = Math.floor((screen.width - w) / 2);
      var ph = Math.floor((screen.height - h) / 2);
     
      if (!popup || popup.closed) popup = window.open
    
    ("popUp.htm?f=" + fld + "&t=" + tbl + "&c=" + col, "sel",
                  "width=" + w + ",height=" + h + ", top=" + ph + ",left=" + pw);
     
      if (popup) popup.focus();
    }
    If I select value TEST in the select name="type", the function open parent page popup.htm in window popup; I select value and close window popup.

    If I select again value TEST in the select name="type", the function NOT open parent page popup.htm in window popup.

    Any suggestion ?

    Code page.htm:

    Code:
    <select size="1" name="type" onchange="OpenPopup(this.options[this.selectedIndex].value, 'tbl', 'elm', 400, 200)">
    
      <option value="TEST">TEST</option>
      <option value="TEST_2">TEST_2</option>
    
    </select>
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    onchange is fired when the value is really changed ... when you always want to open the popup then you may use onclick ... so selecting the same value again instead of a different one prevents the onchange from firing. you could even try to add onclick-handlers directly to the options itself ...

    kind regards

    Comment

    Working...