JS函数openwindow()

来源:互联网 发布:linux c 迭代器 编辑:程序博客网 时间:2024/04/30 00:59

<SCRIPT LANGUAGE="javascript"> <!-- window.open ("page.html", "newwindow", "height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no") //写成一行 --> </SCRIPT> 参数解释: <SCRIPT LANGUAGE="javascript"> js脚本开始; window.open 弹出新窗口的命令; "page.html" 弹出窗口的文件名; "newwindow" 弹出窗口的名字(不是文件名),非必须,可用空"代替; height=100 窗口高度; width=400 窗口宽度; top=0 窗口距离屏幕上方的象素值; left=0 窗口距离屏幕左侧的象素值; toolbar=no 是否显示工具栏,yes为显示; menubar,scrollbars 表示菜单栏和滚动栏。 resizable=no 是否允许改变窗口大小,yes为允许; location=no 是否显示地址栏,yes为允许; status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许; </SCRIPT> js脚本结束

//居中显示 function openWindow(url,winName,width,height) { //     window.open(strURL,"_blank", "height=400, width=600, top=0, left=255, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no");

xposition=0; yposition=0; if ((parseInt(navigator.appVersion) >= 4 )) { xposition = (screen.width - width) / 2; yposition = (screen.height - height) / 2; } theproperty= "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=1," + "scrollbars=0," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," //for Netscape + "screeny=" + yposition + "," //for Netscape + "left=" + xposition + "," //for IE + "top=" + yposition; //for IE window.open(url,winName,theproperty );

}

0 0
原创粉丝点击