Connecting Tech Pros Worldwide Help | Site Map

Window popUp

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 27th, 2008, 06:26 PM
Member
 
Join Date: Apr 2008
Posts: 66
Default 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.  
Reply
  #2  
Old August 27th, 2008, 09:42 PM
gits's Avatar
Moderator
 
Join Date: May 2007
Location: Munich, Germany
Age: 37
Posts: 3,780
Default

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
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.