弹出自定义窗口

时间:2022-09-07 22:48:11

1.window对象的open方法

 window的open方法用于创建一个新窗口,语法如下

window.open(URL,windowname[,windowFeatures][,replaceFlag])

URL: 弹出窗口的URL地址

windowname:弹出窗口的名称,可为空

windowFeature:字符串值,是由逗号分隔的属性赋值表达式,下表为window.open方法的属性

 

属性                          类型                                            说明

height                     整型                                        窗口高度

width                        整型                                        窗口宽度

top                            整型                                        窗口距离屏幕上方的像素值    

left                            整型                                        窗口距离屏幕左侧的像素值

toolbar                      Boolean                                    是否显示工具栏,1或yes为显示,0或no为不显示

menubar                    Boolean                                    是否显示菜单栏,1或yes为显示,0或no为不显示

scrollbars                   Boolean                                    是否显示滚动栏,1或yes为显示,0或no为不显示

resizable                    Boolean                                    是否允许改变窗口大小,1或yes为允许,0或no为不允许

location                     Boolean                                    是否显示地址栏,1或yes为显示,0或no为不显示

status                        Boolean                                    是否显示状态栏,1或yes为显示,0或no为不显示

fullscreen                   Boolean                                    是否全屏显示,1或yes为全屏显示,0或no表示不全屏显示

 

 

 

2.弹出自定义窗口

(1)弹出指定大小和位置的窗口

<script language="Javascript"

<!--

    window.open("new.htm","new","height=100,width=100,top=10,left=20")

-->

</Script>

(2)弹出不显示工具栏,菜单栏和滚动栏的窗口

<script language="Javascript"

<!--

    window.open("new.htm","new","toolbar=no,menubar=no,location=no,scrollbar=no,status=no")

-->

</Script>

(3)弹出全屏窗口

<script language="Javascript"

<!--

    window.open("new.htm","new","fullscreen=yes")

-->

</Script>