zoukankan      html  css  js  c++  java
  • Asp.Net 弹出窗体始终在顶层方法

    方法1、

      是在在被弹出的页面中给body加入以下事件处理即可

    <body onblur="this.focus();" onload="this.focus();">

    每当窗体失去焦点时则立即重新获取焦点,弹出窗口后面的页面上的组件无法被点击。

    此种方法缺点就是页面无法输入内容。

    方法2、使用showModalDialog

    示例代码:

    <script language="javascript" type="text/javascript">
            
    function OpenTopDialog()
            {
                window.showModalDialog(
    'Show.aspx',null,'resizable:yes;scroll:yes;status:no;dialogWidth:800px; dialogHeight:600px;center=yes;help=no');
            }
        
    </script>


    问题1:

       打开showModalDialog后,关闭时会弹出空白页。

      解决方法为:在打开 showModalDialog的页面的Head标记中加上<base target="_self">

     问题2:

       showModalDialog中链接会在新窗口中开启。

    解决方法为:

       打开showModalDialog的页面上加上<base   target="_parent">


    showModalDialog使用方法如下:

      vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])
      vReturnValue = window.showModelessDialog(sURL [, vArguments] [, sFeatures])

     

    参数说明:

      sURL

        必选参数,类型:字符串。用来指定对话框要显示的文档的URL。
      vArguments
        可选参数,类型:变体。用来向对话框传递参数。传递的参数类型不限,包括数组等。对话框通过window.dialogArguments来取得传递进来的参数。
      sFeatures
        可选参数,类型:字符串。用来描述对话框的外观等信息,可以使用以下的一个或几个,用分号“;”隔开。
      dialogHeight 对话框高度,不小于100px,IE4中dialogHeight 和 dialogWidth 默认的单位是em,而IE5中是px,为方便其见,在定义modal方式的对话框时,用px做单位。
      dialogWidth:  对话框宽度。
      dialogLeft:    距离桌面左的距离。
      dialogTop:   离桌面上的距离。
      center: {yes | no | 1 | 0 }:窗口是否居中,默认yes,但仍可以指定高度和宽度。
      help: {yes | no | 1 | 0 }:是否显示帮助按钮,默认yes。
      resizable: {yes | no | 1 | 0 } [IE5+]:是否可被改变大小。默认no。
      status: {yes | no | 1 | 0 } [IE5+]:是否显示状态栏。默认为yes[ Modeless]或no[Modal]。
      scroll:{ yes | no | 1 | 0 | on | off }:指明对话框是否显示滚动条。默认为yes。

    还有几个属性是用在HTA中的,在一般的网页中一般不使用。
      dialogHide:{ yes | no | 1 | 0 | on | off }:在打印或者打印预览时对话框是否隐藏。默认为no。
      edge:{ sunken | raised }:指明对话框的边框样式。默认为raised。
      unadorned:{ yes | no | 1 | 0 | on | off }:默认为no。
  • 相关阅读:
    [转]window.open居中
    WebService实例一
    开发步骤
    ubuntu命令
    ubuntu如何添加软件源
    WebService学习笔记
    android.view.WindowManager$BadTokenException: Unable to add window token null is not for an application
    Dialog的使用
    区分Activity的四种加载模式
    在android 中导入项目后 包出现错误
  • 原文地址:https://www.cnblogs.com/scottckt/p/1432185.html
Copyright © 2011-2022 走看看