saixing


什么是模态?


一旦弹出模态窗口或对话框,如果用户不对其进行操作(如点击确定或取消按钮等),就如法进行其他的操作.

 

弹出模态窗口的语句:

var testSend = window.showModalDialog(\'modal.htm\',\'\',\'dialogHeight:150px;dialogWidth:500px;center:no\');


window.showModelessDialog(sURL[,vArguments][,sFeatures])

 

1)sURL 指明模态窗口的URL地址

2)vArguments 传递参数

3)sFeatures 窗口的外观大小等

 

其中第一个参数必须有,第二三个参数可有可无。


如何传值?

   单击FrontPage.htm(A页面)中的按钮,弹出模态窗口modal.htm(B页面),点击modal.htm中的按钮关闭窗口,并返回值。

A页面js

    function test() {
        alert("ID:" + window.dialogArguments.id+" ;"+"名字:"+ window.dialogArguments.name);
        var message = {
            "state": "begin",
            "info": "404"
        };
        window.returnValue = message;

    }

B页面js

 function test() {
        var person = {
         "id":"001",
        "name":"yangyang"
    };
    var testSend = window.showModalDialog(\'modal.htm\',person,\'dialogHeight:150px;dialogWidth:500px;center:no\');
    alert("状态:" + testSend.state + " ;" + "信息:" + testSend.info);

     }



点击B页面确定按钮,将A页面的值传过来。




关闭B页面,将B页面的值传到A页面。



参数说明:

window.dialogArguments来取得传递进来的参数。

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


分类:

技术点:

相关文章:

  • 2021-11-01
  • 2021-09-25
  • 2021-09-29
  • 2021-09-25
  • 2020-04-01
  • 2021-06-08
  • 2022-01-17
  • 2020-04-15
猜你喜欢
  • 2021-12-04
  • 2021-09-25
  • 2021-09-25
  • 2021-11-07
  • 2021-12-07
  • 2022-01-15
  • 2021-07-09
相关资源
相似解决方案