javascript 打开窗户

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 打开窗户相关的知识,希望对你有一定的参考价值。

<span style="color: #003366; font-weight: bold;">function</span> open_window<span style="color: #66cc66;">&#40;</span>url<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> wparams = <span style="color: #3366CC;">'toolbar=0,location=0,directories=0,status=0,menubar=0,'</span>;
        wparams += <span style="color: #3366CC;">'scrollbars=0,resizable=0,width=280,height=150'</span>;
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> window = window.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span>url, <span style="color: #3366CC;">'window_name'</span>, wparams<span style="color: #66cc66;">&#41;</span>;
    window.<span style="color: #000066;">focus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> create_window<span style="color: #66cc66;">&#40;</span>content<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> wparams = <span style="color: #3366CC;">'toolbar=0,location=0,directories=0,status=0,menubar=0,'</span>;
        wparams += <span style="color: #3366CC;">'scrollbars=0,resizable=0,width=280,height=150'</span>;
&nbsp;
    <span style="color: #003366; font-weight: bold;">var</span> window = window.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">''</span>, <span style="color: #3366CC;">'window_name'</span>, wparams<span style="color: #66cc66;">&#41;</span>;
&nbsp;
    window.<span style="color: #006600;">document</span>.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000066; font-weight: bold;">with</span><span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">document</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span>content<span style="color: #66cc66;">&#41;</span>;
        <span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;br/&gt;&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>javascript:self.close();<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;Close window&lt;/a&gt;&quot;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    window.<span style="color: #006600;">document</span>.<span style="color: #000066;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    window.<span style="color: #000066;">focus</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>

以上是关于javascript 打开窗户的主要内容,如果未能解决你的问题,请参考以下文章

防止窗户打开

第三章:3.9 关上窗户

电脑windows是啥意思

CodeForces 595A

我可以在窗户里面放窗户吗?像一个视频播放器

代做毕业设计1:智能窗户模型