pop up window opens and closes onClick, but link won't open

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amymcdo3
    New Member
    • Aug 2007
    • 6

    pop up window opens and closes onClick, but link won't open

    Hi Everyone,

    I have a popup window that opens when clicking a link. The pop up window asks a question and supplies two buttons, Yes and No. The buttons are images and when the user clicks the button, they will either be linked to another page via the Yes button or they will stay on the same page if they click the No button.

    The popup window is supposed to close once the Yes or No button is clicked, and it does, however, it ignores the link that is attached to the Yes button.

    I am using Dreamweaver to create the code for the popup window:[code=html]
    <a href="javascrip t:void(0)" class="link2" onClick="MM_ope nBrWindow('pop_ EBM.htm','','wi dth=345,height= 160')">Enrollme nt Billing Manual - Independent Practitioners</a>[/code]

    Then I have this code attached to the Yes button:[code=html]
    <td height="40"><di v align="right">< a href="ebm/Practitioners_M anual.pdf" target="_blank" onclick="window .close()"><img src="../images/btn_yes.gif" alt="Yes" width="50" height="20" border="0"></a></div></td>[/code]

    Any suggestions on how I can get this to work?
    Thanks alot for any help you can offer!
    Amy
  • Nahum Silva
    New Member
    • Aug 2007
    • 4

    #2
    Hi emy I think that the problem is that you are trying to open the page in your pop up and not in the pages the show the pop up, I think you can achieve what are you looking if you try somenthing like parent.document and manipulate whatever you want... also you can display not a popup itself instead you can show a div layer for the same purpose... this way you can avoid all popup blocker and all tha stuff.. look into google for submodal popups can help you... see you around...

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, Amy. Welcome to TSDN!

      Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

      Comment

      • amymcdo3
        New Member
        • Aug 2007
        • 6

        #4
        Thanks for the reply, but I forgot to mention that it works in IE, but not Firefox or Netscape. Any suggestions as to what is causing it to not go to the link in Firefox and Netscape? I do have target_blank, so I am not trying to open the linked to page in the same window as the popup....

        thanks!!

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, Amy.

          Modern browsers will execute JavaScript or else follow the href in an anchor tag, but not both.

          Instead, try doing this:
          [code=html]
          <img src="../images/btn_yes.gif" alt="Yes" width="50" height="20" border="0" style="cursor:p ointer;" onclick="window .open('ebm/Practitioners_M anual.pdf'); window.close(); " />
          [/code]

          Comment

          • amymcdo3
            New Member
            • Aug 2007
            • 6

            #6
            Hey Pbmods,

            You are AWESOME! I have been trying to resolve this for 2 days and could not figure out how to make this work in Firefox. It works perfectly now!

            THANKS!!!!
            Amy

            Comment

            • pbmods
              Recognized Expert Expert
              • Apr 2007
              • 5821

              #7
              Heya, Amy.

              Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)

              Comment

              • amymcdo3
                New Member
                • Aug 2007
                • 6

                #8
                Hi again,

                I just checked this in Netscape 8 and Netscape 9, and it opens the link fine, but then the pop up will not close. It stays open and turns white.

                Any suggestions?

                Thanks!!!
                Amy

                Comment

                • pbmods
                  Recognized Expert Expert
                  • Apr 2007
                  • 5821

                  #9
                  Heya, Amy.

                  Maybe try self.close()... . Did you originally open this window using JavaScript, by any chance? Netscape will only allow you to close() what you open().

                  Comment

                  • amymcdo3
                    New Member
                    • Aug 2007
                    • 6

                    #10
                    Hi,

                    I used the code that you gave me in box #5. Do I need to change it self.close now. I am worried that changing it, will make it not work in Firefox......

                    Thanks!!

                    Comment

                    • pbmods
                      Recognized Expert Expert
                      • Apr 2007
                      • 5821

                      #11
                      Heya, Amy.

                      Originally posted by amymcdo3
                      Do I need to change it self.close now. I am worried that changing it, will make it not work in Firefox......
                      lol This is why I am not a professional JavaScript coder :)

                      My recommendation would be to try it; worst case scenario, you can always change it back. Post back with if/how it worked, and we'll go from there.

                      Comment

                      • amymcdo3
                        New Member
                        • Aug 2007
                        • 6

                        #12
                        pop up window problems with Firefox and Netscap

                        Hi,

                        This is in reference to a prior thread that I started yesterday and still cannot figure out.

                        I have a popup window that opens with 2 buttons, one for yes and one for no. When the user clicks yes, it is to go to the linked page and then close the window. If the user clicks no, he will stay on that page and the pop up window will close.

                        There are a couple of problems going on:
                        The first is with Firefox (I just downloaded version2), and it will open the pop up window, but when the Yes button is clicked, it opens the pdf page in the same window as the pop up.

                        The second issue is with Netscape. It will open the link in a new window, but the pop up window stays open and turns white and says about.blank at the top.

                        I am ready to pull my hair out with this by now.
                        Do you have any idea what is going on with Firefox and Netscape? I should mention that everything works fine in IE.

                        Here is my code that is in the initial page that calls the pop up window:[code=html]
                        <a href="javascrip t:void(0)" class="link2" onClick="MM_ope nBrWindow('pop_ EBM.htm','','wi dth=345,height= 160','ebmWindow ')">Enrollmen t Billing Manual - Independent Practitioners</a>[/code]

                        Here is my code in the popup window:[code=html]
                        <td><img src="../images/btn_yes.gif" alt="Yes" width="50" height="20" border="0" style="cursor:p ointer;" onclick="window .open('ebm/Practitioners_M anual.pdf','ebm 1'); window.close(); " /></td>[/code]

                        Thank you!!!
                        Amy

                        Comment

                        • pbmods
                          Recognized Expert Expert
                          • Apr 2007
                          • 5821

                          #13
                          Heya, Amy.

                          Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post. This is the second time I've had to ask.

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #14
                            Threads merged. Please keep all posts relating to one problem in the same thread.

                            The second thread was posted in the Articles section too.

                            Comment

                            Working...