On select open popup and main window

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zeroanarchy
Forum Newbie
Posts: 15
Joined: Wed Jul 21, 2004 8:51 pm

On select open popup and main window

Post by zeroanarchy »

Hi all,

Thanks for taking the time to help

Ok I have no ideas if this is possible and if so how one would do it. What I am tring to do is on select from a dropdown if selection = option 2 then open main page as option2.php and open a popup page pop.php but if the user selects option 1,3,4 then just open the selected main page.

Now the problem is that I can not build the popup code into the page option2.php as it is an outside page.

Any ideas?

Thanks again for your time.
zeroanarchy

Code: Select all

<select onchange="window.location.pathname=this.options&#1111;this.selectedIndex].value">
<option selected value"http://www.mypage.com/S/A.php"> -- Select a number --</option>
  <option value="/S/option1.php">option 1</option>
  <option value="/S/option2.php">option 2</option>
  // what do I need to add to the above line to make it open a popup as  
  // well or is there a better way of doing this?
  <option value="/S/option3.php">option 3</option>
  <option value="/S/option4.php">option4</option>
</select>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

option2.php should open the popup probably...
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Code: Select all

<script language = "javascript">
function do_stuff(p_value)
&#123;
   if(p_value == "/S/option2.php")
   &#123;
      window.open("/S/pop.php","popupWindow","resizable=false.........");
   &#125;
   
   window.location.href = p_value;
&#125;
</script>
.
.
.
.
.
     

<select onchange = "javascript:do_stuff(this.value);">
<option>
.
.
.
.
</select>
Untested and probably syntactically wrong somewhere, but you get the idea.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply