Do Popup On Submit Form?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gulersoner
    New Member
    • Mar 2008
    • 2

    Do Popup On Submit Form?

    Hi,
    I have a simple dropdown menu clickable via a submit/go button.

    /////////
    [HTML]<form name="mymenu" id="mymenu">
    <select name="blabla" size=1>
    <OPTGROUP label="somethin g">
    <option value="a.html">
    link a (must open in popup)
    </option>
    <option value="b.html">
    link b (redirected)
    </option>
    <option value="c.html">
    link c (redirected)
    </option>
    <option value="d.html">
    link d (redirected)
    </option>
    </OPTGROUP>
    </select>
    <input type="button" onClick="locati on=document.mym enu.blabla.opti ons[document.mymenu .blabla.selecte dIndex].value;" value="Go">
    </form>
    [/HTML]
    //////////////

    Normally, the window is redirected to the selected url via onclicking the GO button.

    What i'm looking for is, when I select a *specific* url (for example a.html), only a.html must open in a popup window, *while others are keeping redirected* normally. Something related getelementbyid or what?

    Thanks,
    Soner
    Last edited by gits; Mar 14 '08, 09:07 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    just use a function and pass the value as a parameter to it. now check for the value and use the window.open() method when the value is a.html ...

    kind regards

    Comment

    • gulersoner
      New Member
      • Mar 2008
      • 2

      #3
      Got a good answer in somewhere:


      [HTML]<input type="button" onclick="formCl ick();" value="Git">

      <script language="JavaS cript" type="text/javascript">
      function formClick(){
      var val = document.getEle mentById("blabl a").options[document.getEle mentById("blabl a").selectedInd ex].value;
      if(val.indexOf( "popup.html ") != -1)
      window.open("po pup.html","Wind ow1","menubar=n o,width=430,hei ght=360,toolbar =no");
      else
      document.locati on = val;
      }
      </script>[/HTML]


      ^^Cheers anyway
      Last edited by gits; Mar 18 '08, 04:43 PM. Reason: added code tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        you may shorten line 5 to this:

        [CODE=javascript]var val = document.getEle mentById('blabl a').value;[/CODE]
        kind regards

        Comment

        Working...