How can I open a popup window with a fixed size using the HREF tag?

前端 未结 5 828
旧巷少年郎
旧巷少年郎 2021-01-04 09:57

I have a link like this:

$contact_url = "rentals_id >" . "Contact" . "";
<         


        
相关标签:
5条回答
  • 2021-01-04 10:08

    I can't comment on Esben Skov Pedersen's answer directly, but using the following notation for links:

    <a href="javascript:window.open('http://www.websiteofyourchoice.com');">Click here</a>
    

    In Internet Explorer, the new browser window appears, but the current window navigates to a page which says "[Object]". To avoid this, simple put a "void(0)" behind the JavaScript function.

    Source: https://support.microsoft.com/en-us/kb/257321

    0 讨论(0)
  • 2021-01-04 10:17

    This should work

    <a href="javascript:window.open('document.aspx','mywindowtitle','width=500,height=150')">open window</a>
    
    0 讨论(0)
  • 2021-01-04 10:19

    Plain HTML does not support this. You'll need to use some JavaScript code.

    Also, note that large parts of the world are using a popup blocker nowadays. You may want to reconsider your design!

    0 讨论(0)
  • 2021-01-04 10:28

    Since many browsers block popups by default and popups are really ugly, I recommend using lightbox or thickbox.

    They are prettier and are not popups. They are extra HTML markups that are appended to your document's body with the appropriate CSS content.

    http://jquery.com/demo/thickbox/

    0 讨论(0)
  • 2021-01-04 10:34

    You might want to consider using a div element pop-up window that contains an iframe.

    jQuery Dialog is a simple way to get started. Just add an iframe as the content.

    0 讨论(0)
提交回复
热议问题