javascript - 如何将弹出窗口附加到页面

标签 javascript html css

脚本

<SCRIPT TYPE="text/javascript">
  <!--
    function popup(mylink, windowname)
    {
      if (! window.focus)return true;
        var href;
        if (typeof(mylink) == 'string')
          href=mylink;
        else
         href=acc_like;
      window.open(href, windowname, 'width=400,height=200,scrollbars=yes');
      return false;
    }
  //-->
</SCRIPT>

HTML

<BODY onLoad="popup('autopopup.html', 'ad')">

我收到弹出窗口,但我不希望它在用户点击窗口之外时最小化。

最佳答案

在我看来你应该使用 jquery dialog要得到你想要的,下面的示例(在 jsFiddle 上试试):

<!DOCTYPE html>

<html>
<head>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />

    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>  
    <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $( "#dialog-form" ).dialog({
                modal: true <!-- is background page responsive or not --> 
            });
        });
    </script>
</head>
<body>      
    Background information
    <div id="dialog-form" title="Hello">Basic information</div> 
</body>
</html>

关于javascript - 如何将弹出窗口附加到页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17378844/

相关文章:

javascript - 为什么我在express应用程序中出现 ' cannot GET '页面?

javascript - 通过单词检查两个文本的相似度?

Javascript:访问父元素时未定义

html - 为什么缩放会改变我的 html 页面的设计布局?

css - 花式 css float + clearing

javascript - 单击 div 时显示表单

javascript - 在 jQuery.extend() 中使用 $(this)

javascript - 如何防止文本选择阻碍 onMouseMove 事件?

Php Checkbox Checked 挣扎

html - 在 Mac 上垂直对齐 div 中的表情符号