Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/394.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在html页面上设计弹出窗口_Javascript_Html_Popup - Fatal编程技术网

Javascript 在html页面上设计弹出窗口

Javascript 在html页面上设计弹出窗口,javascript,html,popup,Javascript,Html,Popup,由于我对HTML和JavaScript非常陌生,我想知道是否有像警报弹出窗口这样的弹出窗口?正如我想的那样,JavaScript中有三个预定义的弹出窗口:警报、确认和提示。但我想制作一个自定义弹出窗口,其中包含HTML代码,但我不知道如何实现这一点 JavaScript本身是否有覆盖弹出窗口外观的方法,或者是否需要导入某些包来实现此目的?导入 一个很好的例子是Twitter引导的模态控制-http://twitter.github.com/bootstrap/javascript.htmlmod

由于我对HTML和JavaScript非常陌生,我想知道是否有像警报弹出窗口这样的弹出窗口?正如我想的那样,JavaScript中有三个预定义的弹出窗口:警报、确认和提示。但我想制作一个自定义弹出窗口,其中包含HTML代码,但我不知道如何实现这一点

JavaScript本身是否有覆盖弹出窗口外观的方法,或者是否需要导入某些包来实现此目的?

导入

一个很好的例子是Twitter引导的模态控制-http://twitter.github.com/bootstrap/javascript.htmlmodals.导入


一个很好的例子是Twitter引导的模态控制-http://twitter.github.com/bootstrap/javascript.htmlmodals.您不能将自定义HTML放入警报中


我建议使用创建自定义对话框。它们将位于页面顶部的玻璃窗格中,而不是弹出窗口中

您不能将自定义HTML放入警报中


我建议使用创建自定义对话框。它们将用玻璃窗格显示在页面顶部,而不是在弹出窗口中

听起来你需要一个灯箱,而不一定需要一个弹出窗口。这里有很多,如果您使用jquery,那么就有很多免费的jquerylightbox插件可用


你可以看到很多例子,我个人喜欢jQuery lightbox插件。

听起来你需要一个lightbox,而不一定需要一个弹出窗口。这里有很多,如果您使用jquery,那么就有很多免费的jquerylightbox插件可用


你可以看到很多例子,我个人喜欢jQuery lightbox插件。

你不能改变浏览器提供的对话框的外观,这些对话框可以通过你在问题中提到的功能访问


您需要在Javascript中构建一些模仿对话框行为的东西。我建议不要从头开始,而要使用一个可以让您轻松创建对话框的库。一个很好的例子是。

您不能改变浏览器提供的对话框的外观,这些对话框可以通过您在问题中提到的功能访问


您需要在Javascript中构建一些模仿对话框行为的东西。我建议不要从头开始,而要使用一个可以让您轻松创建对话框的库。一个很好的例子是。

是。您可以使用许多不同的弹出窗口,它们通常被称为模式窗口或对话框窗口

您可以使用jqueryui或Twitter引导等库使用HTML创建自定义警报。还有其他的,但我建议这些是更常见的

jQuery用户界面

推特引导

jQuery UI页面中的一个模式示例可以帮助您入门:

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Dialog - Modal confirmation</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script>
    $(function() {
        $( "#dialog-confirm" ).dialog({
            resizable: false,
            height:140,
            modal: true,
            buttons: {
                "Delete all items": function() {
                    $( this ).dialog( "close" );
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });
    </script>
</head>
<body>

<div id="dialog-confirm" title="Empty the recycle bin?">
    <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>

<p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>


</body>
</html>

对。您可以使用许多不同的弹出窗口,它们通常被称为模式窗口或对话框窗口

您可以使用jqueryui或Twitter引导等库使用HTML创建自定义警报。还有其他的,但我建议这些是更常见的

jQuery用户界面

推特引导

jQuery UI页面中的一个模式示例可以帮助您入门:

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Dialog - Modal confirmation</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <script>
    $(function() {
        $( "#dialog-confirm" ).dialog({
            resizable: false,
            height:140,
            modal: true,
            buttons: {
                "Delete all items": function() {
                    $( this ).dialog( "close" );
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            }
        });
    });
    </script>
</head>
<body>

<div id="dialog-confirm" title="Empty the recycle bin?">
    <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>These items will be permanently deleted and cannot be recovered. Are you sure?</p>
</div>

<p>Sed vel diam id libero <a href="http://example.com">rutrum convallis</a>. Donec aliquet leo vel magna. Phasellus rhoncus faucibus ante. Etiam bibendum, enim faucibus aliquet rhoncus, arcu felis ultricies neque, sit amet auctor elit eros a lectus.</p>


</body>
</html>

我个人会用颜色盒来做这个。Colorbox用途广泛,可用于显示警报以及其他内容


我个人会用颜色盒来做这个。Colorbox用途广泛,可用于显示警报以及其他内容


有许多JS库包含弹出窗口,从AjaxControlToolkit到jQuery等等


如果希望保持简单,可以使用DIVs自己创建它。您可以创建一个绝对定位的DIV,它将表示您的弹出窗口,并使用JavaScript显示和隐藏它,例如通过设置显示或可见属性。

有许多JS库包含弹出窗口,从AjaxControlToolkit到jQuery等等

如果希望保持简单,可以使用DIVs自己创建它。您可以创建一个绝对定位的DIV,它将代表您的弹出窗口,并使用JavaScript显示和隐藏它,例如通过设置显示或可见属性。

详情>p{ 填充:0.5雷姆; 背景:轻珊瑚; 保证金:0; 显示器:flex; 弯曲方向:柱 } 详情[公开]{ 位置:固定; 宽度:33%; 左:33%; 顶部:10vh; 外形:10000px 000000 D4固体 } 弹出窗口 由html提供支持 弹出窗口 由html提供支持 对

详情>p{ 填充:0.5雷姆; 背景:轻珊瑚; 保证金:0; 显示器:flex; 弯曲方向:柱 } 详情[公开]{ 位置:固定; 宽度:33%; 左:33%; 顶部:10vh; 外形:10000px 000000 D4固体 } 弹出窗口 由html提供支持 弹出窗口 由html提供支持