4 Replies Latest reply on Mar 6, 2007 8:25 PM by fhh

    How can i popup a browser window?

       

      function openWindow(element)
      {
       var vWinUsers = window.open("<userPicker.resetQuery>?formId=projectAddForm&multiSelect=&element=' + element, 'UserPicker', 'status=yes,resizable=yes,top=100,left=200,width=580,height=750,scrollbars=yes');
       vWinUsers.opener = self;
       vWinUsers.focus();
      }
      </script>
       <input name="pm" />
       <a href="javascript:openWindow('pm');">
       <h:graphicImage url="/img/filter_public.gif" border="0"
       height="16" width="16" align="absMiddle"
       title="Select a user"
       />
       </a>


      Which code shall i replace <userPicker.resetQuery> with?

      if i use
      <h:commandLink action="#{hotelBooking.selectHotel}" target="_blank">View Hotel</h:commandLink>
      , how to control the window's size like "top=100,left=200,width=580,height=750"?


        • 1. Re: How can i popup a browser window?

          anybody can help me?

          • 2. Re: How can i popup a browser window?

            I do it in a project but I'm not sure if it is the best way to do it. Here it goes:

            You have a event-scoped Seam component:

            
            @Name("jspopup")
            public class JsPopup {
            
             private String name;
             private String url;
             private int height;
             private int width;
             // etc.
            
            
            /* Getters and Setters */
            
            
            }
            


            In your action method you create the popup component and outject it. Now
            add some javascript at he beginning of the page:

            <c:if test"! empty popup">
            
             <script language="javascsript>
             var vWinUsers = window.open('
            #{jspopup.url}', #{jspopup.name},'width=#{jspopup.width},width=#{jspopup.height});
             vWinUsers.opener = self;
             vWinUsers.focus()
             </script>
            
            </c:if>
            


            If you find a better way to do it please let me know.

            Regards

            Felix

            • 3. Re: How can i popup a browser window?

              i am not very clear, could you paste all codes here, or send them to chicochen@hotmail.com, thanks a lot!

              • 4. Re: How can i popup a browser window?

                I'm sorry but that is all there is to it. There is no more code to send.

                If you post what part of my example you don't understand, then I'll try to explain.

                Regards

                Felix