Select value and window popUp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • viki1967
    Contributor
    • Oct 2007
    • 263

    Select value and window popUp

    Hello.

    It's possible at this select when you select only the value BBB automatically open a web page in the window popUp ?

    Code:
    <form method="POST" action="next.asp">
      <p>
      <select size="1" name="D1">
      <option>Select</option>
      <option value="AAA">AAA</option>
      <option value="BBB">BBB</option>
      </select>
      
      <input type="submit" value="GO" name="B1">
      <input type="reset" value="RESET" name="B2">
      </p>
      
    </form>
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Yes, you can call a function onchange which checks the value of selected. If it's "BBB", open a pop up window using window.open().

    Comment

    • viki1967
      Contributor
      • Oct 2007
      • 263

      #3
      thanks x your answer.

      I write this code and working... its right?

      Code:
      <select size="1" name="D1" onchange="if(this.value=='BBB')window.open('http://myurl.com');">

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Yes, that should work. If you're later planning to have more than one line of code, it would be better in a function. Anyway, a good job on figuring it out yourself :)

        Comment

        Working...