I'd like to open a popup window, but without given a link : just open it with some HTML and Javascript code (that I pass trought the function).
Tried with :
window.open($('.my_html').html(), "Booking", "width=950,height=680");
How can I do it?
I'd like to open a popup window, but without given a link : just open it with some HTML and Javascript code (that I pass trought the function).
Tried with :
window.open($('.my_html').html(), "Booking", "width=950,height=680");
How can I do it?
Share Improve this question edited Oct 26, 2011 at 8:03 markzzz asked Oct 26, 2011 at 7:58 markzzzmarkzzz 48.1k126 gold badges318 silver badges534 bronze badges 2- 2 Have you tried anything or would you like us to do your work for you? – Simon Commented Oct 26, 2011 at 8:02
- Yeah of course. Added an example... – markzzz Commented Oct 26, 2011 at 8:03
4 Answers
Reset to default 2writeConsole('Hello from JavaScript!');
function writeConsole(content) {
top.consoleRef=window.open('','myconsole','width=350,height=250');
top.consoleRef.document.write(content)
top.consoleRef.document.close()
}
Source
You can do it like this:
var popup = window.open(#mySettings#);
and then
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>');
You can call function on any event, and supply content you want to show.
do you have to use browser popups? They're annoying and can be blocked by ad-blockers.
Why not do it as modal windows instead? like this: http://www.sohtanaka./web-design/inline-modal-window-w-css-and-jquery/
or the jQuery plugin jqModal.