CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Wednesday, January 10, 2007

showModalDialog Examples

Example - 1

a.html - Parant Window

<html>
<head>
 <script>
  function fu()
  {
   returnValue = window.showModalDialog('b.html');
   var text = document.getElementById("text");
   text.value = returnValue;
  }
 </script>
</head>
<body>
 <input type=button value="click me" onclick="return fu();">
 <input type=text id=text>
</body>
</html>

b.html - Child Window

<html>
<head>
 <script>
  function fu()
  {
   var text = document.getElementById("text");
   window.returnValue=text.value;
   window.close();
  }
 </script>
</head>
<body>
 <input type=button value="close" onclick="return fu();">
 <input type=text id=text>
</body>
</html>

Example 2


 

Parent window

var strReturnValueArray = new Array;
                strReturnValueArray[0]="";
                strReturnValueArray[1]="";
                var bReturn;
                bReturn = window.showModalDialog('frmListSelect.aspx?spname='+spName +'&ms='+msg,strReturnValueArray, 'dialogWidth:' +
                         width +'px; dialogHeight:500px;status:no;help:no;close:no');

                if (bReturn=="Y" || bReturn=="y" )
                        {
                                if (strReturnValueArray[0]!='')
                                {
                                        strVar1.value=strReturnValueArray[0];
                                }
                                       
                                if (strReturnValueArray[1]!='')
                                {
                                        strVar2.value=strReturnValueArray[1];
                                }
                        }



 

Child Window:

 
function onSelectRadio(prgID,varID)
                {              
                                               
                                        strReturnValueArray = dialogArguments;
                                        strReturnValueArray[0] = prgID;
                                        strReturnValueArray[1] = varID;
                                        window.returnValue = "Y";
                                        window.close();
                }

Post a Comment

swathi said...

Hi,
I have a table with three rows in which three rows are having
now i want to read three rows of fileupload,
im getting only one file,
how can i get three file names in struts2 action class..
reply rply me...