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

时间:2013-06-29 09:43:32

标签: javascript html css

SCRIPT

<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')">

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

1 个答案:

答案 0 :(得分:1)

在我看来,您应该使用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>