简体   繁体   中英

PHP, JavaScript popup window without top bar

So I need to make pop-up window without top bar. What I mean:

When I click button (days of calender are buttons) I need that poped-up window like this: 弹出

I have script for now:

<script type="text/javascript">
 <!--
  var stile = "top=10, left=10, width=600, height=800 status=no, menubar=no, toolbar=no scrollbar=no";
     function Popup(apri) {
        window.open(apri, "", stile);
     }
 //-->
</script>
<a href="javascript:Popup('YOURPAGE.html')">show popup</a>

After I click button It open this:

弹出式视窗2

I need to make that opened not Firefox, but would be shown only grey content inside with "x" to close window:

X

Thank you for answers.

You cannot. Browsers provide no mechanism to do so.

The closest you could come would be to use HTML and CSS (with JS to add draggable support and handle the close button) to create something that looks like a window, but is really part of the page (and thus cannot be dragged outside the window as it is not a window in its own right).

As mentioned by others, you can't create a popup that doesn't use the full browser window.

However, what you can do is create what is known as a 'popover'.

That is, rather than use a new window, you use a combination of javascript, HTML and CSS to create something that behaves quite like a popup, but which is actually in the same browser window.

Think along the lines of how date pickers work on travel sites nowadays.

One that works quite well is this jQuery plugin: https://github.com/klaas4/jQuery.popover

It has a single page set of instructions in Demo.html that should get you started.

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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