将html页面显示为弹出页面

时间:2015-03-19 16:48:49

标签: javascript html5

我有一个弹出页面,当我点击此按钮时,我想显示它:



 <script type="text/javascript">
                
                        function open_infos()
                        {
                                width = 600;
                                height = 400;
                                if(window.innerWidth)
                                {
                                        var left = (window.innerWidth-width)/2;
                                        var top = (window.innerHeight-height)/2;
                                }
                                else
                                {
                                        var left = (document.body.clientWidth-width)/2;
                                        var top = (document.body.clientHeight-height)/2;
                                }   
                                window.open('app.livarticles','articles','menubar=no, scrollbars=no, top='+top+', left='+left+', width='+width+', height='+height+'');
                                console.log("error...")
                        }
                
                </script>
&#13;
<div class="btn-group">
    <div class="btn btn-icon"> 
        <a onclick="javascript:open_infos();" data-toggle="tooltip" title="xxxxxx">
            <img src="img\10536.png" class="m-b-xs w-xs">
</a> 
    </div></div>
&#13;
&#13;
&#13;

我使用AngularJS,这是路由文件,config.router.js:

&#13;
&#13;
.state('app.livarticles', {
                   url: '/livraison/article',
		   templateUrl: 'tpl/livarticles.html'
              })
&#13;
&#13;
&#13;

但是页面没有显示在弹出页面中,任何想法都很高兴和感谢 更新: 当我手动将URL放在脚本中时,这就是我得到的:

&#13;
&#13;
 window.open('tpl/livarticles.html',.........
&#13;
&#13;
&#13;

enter image description here

1 个答案:

答案 0 :(得分:2)

app.livarticles不是一个合适的网址。它应该是这样的:

 window.open('http://thesite.com/livarticles', ...);

https://developer.mozilla.org/en-US/docs/Web/API/Window/open