显示新窗口(在窗口正中)

来源:互联网 发布:淘宝店主风修图教程 编辑:程序博客网 时间:2024/04/28 14:52
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="old.aspx.cs" Inherits="old" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    <title></title>    <script type="text/javascript">     function openwindow(url,name,iWidth,iHeight)  {    var url;                            //转向网页的地址;    var name;                           //网页名称,可为空;    var iWidth;                         //弹出窗口的宽度;    var iHeight;                        //弹出窗口的高度;    //window.screen.height获得屏幕的高,window.screen.width获得屏幕的宽    var iTop = (window.screen.height-30-iHeight)/2;       //获得窗口的垂直位置;    var iLeft = (window.screen.width-10-iWidth)/2;        //获得窗口的水平位置;    window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');   }      </script></head><body>    <form id="form1" runat="server">    <div>        <input id="Button1" type="button" value="打开新窗口"  onclick="openwindow('news.aspx','',300,400)"/>    </div>    </form></body></html>

原创粉丝点击