Web Analytics Made Easy -
StatCounter Pop-up/form script - CodingForum

Announcement

Collapse
No announcement yet.

Pop-up/form script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Pop-up/form script

    I need a script to do the following:

    When one specific option is selected and submitted from a drop down (form option) menu and submitted I want a pop-up box with a text message and an "OK" button to click, before being taken through in the main window to another page.

    I've acheived a similar thing with an image map using the following code:

    <AREA SHAPE="poly" COORDS="165,99, 168,118, 182,118, 186,114, 177,103, 177,98" onClick="alert('My text message here.');window.top.location.href('myurl.htm')">


    Any suggestions???

  • #2
    Well, why don't you use a simple drop-down-menu and give the same events that you gave in the <AREA> tag.
    Scripting | JavaScripts | PerlScripts | Python Scripts | Articles | My Journal

    Comment


    • #3
      Code:
      <form name="formName">
      <select name="selectBox" onchange="foo();">
      <option>the text of your option</option>
      </select>
      </form>
      function foo() {
           if (document.formName.selectBox.options[document.formName.selectBox.selectedIndex].text == "the text of your option") {
              alert("bar");
              window.location = "whereever.htm";
              }
          }
      joh6nn
      New to the CF scene
      Last edited by joh6nn; Jul 1, 2002, 08:19 AM.
      bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

      i am a loser geek, crazy with an evil streak,
      yes i do believe there is a violent thing inside of me.

      Comment


      • #4
        thanks.

        Have just tested both in Netscape, and my onClick="alert('My text message here.');window.top.location.href('myurl.htm')" doesn't work at all.

        Any alternative suggestions?

        Comment


        • #5
          the code i posted should do what you want.
          bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

          i am a loser geek, crazy with an evil streak,
          yes i do believe there is a violent thing inside of me.

          Comment


          • #6
            ...the code you posted worked fine for the form. However, the code I already had for the image map doesn't work in Netscape.

            I tried adapting your code as well - swaped my window.top.location.href for your window.location - but again, it only worked in IE.

            Comment


            • #7
              which version of netscape?
              bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

              i am a loser geek, crazy with an evil streak,
              yes i do believe there is a violent thing inside of me.

              Comment


              • #8
                4.79

                Comment


                • #9
                  netscape 4 doesn't support the onclick event in image maps. there's nothing you can do about it. it will work in every other browser, though.
                  bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

                  i am a loser geek, crazy with an evil streak,
                  yes i do believe there is a violent thing inside of me.

                  Comment


                  • #10
                    Oh, ok. Thanks for the info.

                    Comment

                    Working...
                    X