469,348 Members | 1,261 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,348 developers. It's quick & easy.

Window popUp

Hi everyone.

I have problem with this function javascript:

Expand|Select|Wrap|Line Numbers
  1. var popup = null;
  2.  
  3. function OpenPopup(fld, tbl, col, w, h)
  4. {
  5.   var pw = Math.floor((screen.width - w) / 2);
  6.   var ph = Math.floor((screen.height - h) / 2);
  7.  
  8.   if (!popup || popup.closed) popup = window.open
  9.  
  10. ("popUp.htm?f=" + fld + "&t=" + tbl + "&c=" + col, "sel",
  11.               "width=" + w + ",height=" + h + ", top=" + ph + ",left=" + pw);
  12.  
  13.   if (popup) popup.focus();
  14. }
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:

Expand|Select|Wrap|Line Numbers
  1. <select size="1" name="type" onchange="OpenPopup(this.options[this.selectedIndex].value, 'tbl', 'elm', 400, 200)">
  2.  
  3.   <option value="TEST">TEST</option>
  4.   <option value="TEST_2">TEST_2</option>
  5.  
  6. </select>
  7.  
Aug 27 '08 #1
1 1484
gits
5,390 Expert Mod 4TB
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
Aug 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Scott | last post: by
3 posts views Thread by Michael | last post: by
19 posts views Thread by Darren | last post: by
7 posts views Thread by E Michael Brandt | last post: by
14 posts views Thread by D. Alvarado | last post: by
7 posts views Thread by anthony.turcotte | last post: by
11 posts views Thread by V S Rawat | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.