• window.showModalDialog()用法


    window.showModalDialog()用来创建模态对话框

    语法为:vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures]);

    参数:

    (1)sURL :指定对话框要显示的文档的URL,字符串,必填

    (2)vArguments:要向对话框传递的参数,变体(数组、变量等),选填

    (3)sFeatures:生成对话框的外观信息,字符串,选填

       -- 外观信息参数有:

    dialogHeight 对话框高度 不小于100px
    dialogWidth 对话框宽度  
    dialogLeft 离屏幕左的距离  
    dialogTop 离屏幕上的距离  
    center 是否居中 默认yes(yes:1,no:0)
    help 是否显示帮助按钮 默认yes
    resizable 是否可被改变大小 默认no
    status 是否显示状态栏 Modal默认no,Modeless默认yes
    scroll 是否显示滚动条 默认为yes
     1 <script type="text/javascript">
     2 //主页面
     3 function openModalDialog() {
     4         var message = new Array();
     5         message[0] = document.getElementById("linename").value;
     6         message[1] = ocument.getElementById("fromstation").value;
     7         message[2] = document.getElementById("tostation").value;
     8         
     9         var obj = window.showModalDialog("Home/generate", message, 'dialogWidth:300px;dialogHeight:380px;');
    10 
    11     }
    12     </script>
    13     

    在打开的对话框中使用window.dialogArguments来取得传递进来的参数

    1 <script type="text/javascript">
    2 //对话框
    3     function getArguments() {
    4        var lineName = window.dialogArguments[0];
    5        var fromStationName = window.dialogArguments[1];
    6        var toStationName = window.dialogArguments[2];
    7     }
    8 </script>

    通过window.returnValue向打开对话框的窗口返回信息

    1 <script>
    2     window.returnValue="aaaaa";
    3 </script>

    另外,showModalessDialog用法基本一致

    模态与非模态区别:

    showModalDialog:被打开后就会始终保持输入焦点。除非对话框被关闭,否则用户无法切换到主窗口。类似alert的运行效果。
    showModelessDialog:被打开后,用户可以随机切换输入焦点,对主窗口没有任何影响。

  • 相关阅读:
    flex>导航
    flex>图表控件
    Struts2>Cannot find the tag library descriptor for /strutstags
    jsp>Smartupload例子代码
    flex>MXML语法
    解决JBoss只能通过localhost(127.0.0.1)而不能通过IP访问
    jsp>tomcat配置虚拟目录
    JSF>概述
    Struts2>中文乱码
    flex>HttpService
  • 原文地址:https://www.cnblogs.com/panpan-v1/p/4449776.html
Copyright © 2020-2023  润新知