简体   繁体   English

如何使用 HREF 标签打开固定大小的弹出窗口?

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

I have a link like this:我有一个这样的链接:

$contact_url = "<a href=rentals_popup.php?id=$row->rentals_id >" . "Contact" . "</a>";

How can I open that page in a different window with?如何在不同的窗口中打开该页面?

Smaller width and height更小的宽度和高度

Disabled maximize button禁用最大化按钮

这应该工作

<a href="javascript:window.open('document.aspx','mywindowtitle','width=500,height=150')">open window</a>

Plain HTML does not support this.纯 HTML 不支持这一点。 You'll need to use some JavaScript code.您需要使用一些 JavaScript 代码。

Also, note that large parts of the world are using a popup blocker nowadays.另请注意,当今世界上大部分地区都在使用弹出窗口阻止程序。 You may want to reconsider your design!您可能需要重新考虑您的设计!

Since many browsers block popups by default and popups are really ugly, I recommend using lightbox or thickbox.由于许多浏览器在默认情况下会阻止弹出窗口并且弹出窗口非常丑陋,因此我建议使用 lightbox 或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.它们是附加到具有适当 CSS 内容的文档正文的额外 HTML 标记。

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

I can't comment on Esben Skov Pedersen's answer directly, but using the following notation for links:我无法直接评论Esben Skov Pedersen 的回答,但对链接使用以下符号:

<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]".在 Internet Explorer 中,会出现新的浏览器窗口,但当前窗口导航到显示“[Object]”的页面。 To avoid this, simple put a "void(0)" behind the JavaScript function.为了避免这种情况,简单地在 JavaScript 函数后面放一个“void(0)”。

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

You might want to consider using a div element pop-up window that contains an iframe.您可能需要考虑使用包含 iframe 的div元素弹出窗口。

jQuery Dialog is a simple way to get started. jQuery Dialog是一种简单的入门方式。 Just add an iframe as the content .只需添加一个 iframe 作为内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM