zoukankan      html  css  js  c++  java
  • window.dialogArguments的使用

    dialogArguments只能在mode和modeless窗口中才能使用,可以传递传递任意类型的值,
    上例就是传得失window. 在以前的项目中,页面之间传递参数经常使用的是url后接参数的形式,
    现在终于发现dialogArguments不愧为更好的方法。
     
    <HTML>
    <HEAD>
    <TITLE>showModelessDialogEX.htm</TITLE>
    <SCRIPT>
    var sUserName="";
    
    function fnCallDialog(){
     showModelessDialog("myDialog.htm",window,"status:false;dialogWidth:300px;dialogHeight:300px");
    }
    
    function fnUpdate(){
        oName.innerText = sUserName;
    }
    </SCRIPT>
    </HEAD><BODY>
    <P>Enter your first name:
     <SPAN ID="oName" STYLE="color:red;font-size:24">Joan</SPAN></P>
     <INPUT TYPE="button" 
    VALUE="Display Modeless Dialog" onclick="fnCallDialog()">
    </BODY>
    </HTML>

    Here is the code for "myDialog.htm".
    <HTML>
    <HEAD>
    <TITLE>myDialog.htm</TITLE>
    <SCRIPT>
    function fnGetInfo() {
    var sData = dialogArguments;
    sData.sUserName = oEnterName.value;
    sData.fnUpdate();
    }
    function fnCancel() {
    var sData = dialogArguments;
    sData.sUserName = "Joan";
    sData.fnUpdate();
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <LABEL FOR="oEnterName" ACCESSKEY="f">
    Enter your <SPAN STYLE="text-decoration:underline">F</SPAN>irst Name</LABEL>
    <INPUT ID=oEnterName><BR><BR>
    <INPUT VALUE="Apply" TYPE=button onclick="fnGetInfo();">
    <INPUT VALUE="Ok" TYPE=button onclick="fnGetInfo();window.close();">
    <INPUT VALUE="Cancel" TYPE=button onclick="fnCancel();window.close();">
    </BODY>
    </HTML>

  • 相关阅读:
    P2679 子串
    线段树优化建边
    P2444 [POI2000]病毒
    P3966 [TJOI2013]单词
    4327: JSOI2012 玄武密码
    UVA1449 Dominating Patterns
    P1250 种树
    P2255 [USACO14JAN]记录奥林比克
    SP283 NAPTIME
    P3436 [POI2006]PRO-Professor Szu
  • 原文地址:https://www.cnblogs.com/pricks/p/1666683.html
Copyright © 2011-2022 走看看