用我自己的html/javascript代码打开一个弹出窗口

Open a popup windows with my own html/javascript code

本文关键字:一个 窗口 html 自己的 我自己 javascript 代码      更新时间:2023-09-26

我想打开一个弹出窗口,但没有给出链接:只需用一些HTML和Javascript代码打开它(我把它传给函数(。

尝试使用:

window.open($('.my_html').html(), "Booking", "width=950,height=680");

我该怎么做?

writeConsole('Hello from JavaScript!');
function writeConsole(content) {
 top.consoleRef=window.open('','myconsole','width=350,height=250');
 top.consoleRef.document.write(content)
 top.consoleRef.document.close()
}

你可以这样做:

var popup = window.open(#mySettings#);

然后

popup.document.write('#myHTML#');
function openpopup(content){ 
    winpops=window.open('',"test","fullscreen=no,toolbar=yes,status=yes, " +
    "menubar=yes,scrollbars=yes,resizable=yes,directories=yes,location=yes, " +
    "width=500,height=400,left=100,top=100,screenX=100,screenY=100");
    winpops.document.write(content);
} 
openpopup('<h1>This is some test content</h1>');

您可以对任何事件调用函数,并提供要显示的内容。

你必须使用浏览器弹出窗口吗?它们很烦人,可以被广告屏蔽程序屏蔽。

为什么不将其作为模态窗口?像这样:http://www.sohtanaka.com/web-design/inline-modal-window-w-css-and-jquery/

或者jQuery插件jqModal。