主體WEB頁中:
private void Page_Load(object sender, System.EventArgs e)
{
string strScript="<script language=\"javascript\">\n"
//-------------------------------------------------單個值返回
strScript += "function GetValue(InfoA,InfoB){\n";
strScript += "var strID=window.showModalDialog('PopForms/TestPop.aspx?ParamA='+InfoA+'&ParamB='+InfoB,null,";
strScript +="'dialogWidth:450px;dialogHeight:480px;center:1;scroll:1;help:0;status:0;resizable:no;')\n";
strScript += "if (strID!=undefined)\n document.all['" + txtText.ClientID + "'].value=strID;\n" ;//結果strID賦值給txtText
strScript += "}\n"; //如果返回的是數組
//------------------------------------------------ 多值返回
sbScript.Append("function OpenEditLot(){\n");
sbScript.Append("var strID=window.showModalDialog('PopForms/Test.aspx?myTime='+Date(),null,");
sbScript.Append("'dialogWidth:433px;dialogHeight:450px;center:1;scroll:1;help:0;status:0;resizable:no;')\n");
sbScript.Append("if(strID!=undefined) {document.all['" + TxtA.ClientID + "'].value=strID[0]\n");
sbScript.Append(" document.all['" + TxtB.ClientID + "'].value=strID[1]\n");
sbScript.Append(" document.all['" + TxtC.ClientID + "'].value=strID[2]\n}");
sbScript.Append("}\n");
// more and here....
//-------------------------------------------------
strScript += "</script>";
this.Page.RegisterClientScriptBlock("clientScript", strScript);
if(!IsPostBack)
{
btnTest.Attributes["onclick"] = "GetValue(document.all('"+txtA.ClientID+"').checked,document.all('"+
txtB.ClientID+"').value)";
}
}
彈出WEB頁中:
1.HTML中定義返回函數,供在頁面中調用返回函數
<HEAD>
<title>QueryLot</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="javascript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="../../WebControler/ICMES.css" type="text/css" rel="stylesheet">
<base target="_self">
<script language="javascript">
function ReturnValue(PamA,PamB,PamC)
{
var my_array = new Array(PamA, PamB,PamC
private void Page_Load(object sender, System.EventArgs e)
{
string strScript="<script language=\"javascript\">\n"
//-------------------------------------------------單個值返回
strScript += "function GetValue(InfoA,InfoB){\n";
strScript += "var strID=window.showModalDialog('PopForms/TestPop.aspx?ParamA='+InfoA+'&ParamB='+InfoB,null,";
strScript +="'dialogWidth:450px;dialogHeight:480px;center:1;scroll:1;help:0;status:0;resizable:no;')\n";
strScript += "if (strID!=undefined)\n document.all['" + txtText.ClientID + "'].value=strID;\n" ;//結果strID賦值給txtText
strScript += "}\n"; //如果返回的是數組
//------------------------------------------------ 多值返回
sbScript.Append("function OpenEditLot(){\n");
sbScript.Append("var strID=window.showModalDialog('PopForms/Test.aspx?myTime='+Date(),null,");
sbScript.Append("'dialogWidth:433px;dialogHeight:450px;center:1;scroll:1;help:0;status:0;resizable:no;')\n");
sbScript.Append("if(strID!=undefined) {document.all['" + TxtA.ClientID + "'].value=strID[0]\n");
sbScript.Append(" document.all['" + TxtB.ClientID + "'].value=strID[1]\n");
sbScript.Append(" document.all['" + TxtC.ClientID + "'].value=strID[2]\n}");
sbScript.Append("}\n");
// more and here....
//-------------------------------------------------
strScript += "</script>";
this.Page.RegisterClientScriptBlock("clientScript", strScript);
if(!IsPostBack)
{
btnTest.Attributes["onclick"] = "GetValue(document.all('"+txtA.ClientID+"').checked,document.all('"+
txtB.ClientID+"').value)";
}
}
彈出WEB頁中:
1.HTML中定義返回函數,供在頁面中調用返回函數
<HEAD>
<title>QueryLot</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="javascript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="../../WebControler/ICMES.css" type="text/css" rel="stylesheet">
<base target="_self">
<script language="javascript">
function ReturnValue(PamA,PamB,PamC)
{
var my_array = new Array(PamA, PamB,PamC
没有相关信息学院
| 对此文章发表了评论 |

