日期:2010-05-20  浏览次数:20608 次

1.在ASP.net页面上,执行JSP(1),在PageLoad中,添加.Attributes.Add

    this.imgSelectBatchID.Attributes.Add("onclick","SelectSwatchCheckBill(ctlProductID,ctlNofityCom,ctlCheckBillID,ctlSelBatchID);");

对应的 jsp过程

function SelectSwatchCheckBill(ProductID,CompanyID,InCheckBillID,BatchID)
{
 para=ProductID.value
 para1=CompanyID.value
 var obj = new Object();
 obj.Var1=BatchID;
 obj.Var2=InCheckBillID; 
 window.showModalDialog('../selectforms/SelectFrame.aspx?url='../selectforms/sglSelectSwatch.aspx&type='+para+'&companyid='+para1,obj,
 'dialogheight=580px;dialogwidth=700px;status=no;edge=raised;scroll=no'); 
}

aspx的代码页,取得查询参数

  private string Type
  {
   get
   {
    if (ViewState["Type"] != null)
     return ViewState["Type"].ToString();
    else
     return "";
   }
   set
   {
    ViewState["Type"] = value;
   }
  }

  private string CompanyID
  {
   get
   {
    if (ViewState["CompanyID"] != null)
     return ViewState["CompanyID"].ToString();
    else
     return "";
   }
   set
   {
    ViewState["CompanyID"] = value;
   }
  }

  private void Page_Load(object sender, System.EventArgs e)
  {
   if (!IsPostBack)
   {
    try
    {
     Type = Request.QueryString["type"].ToString();
     CompanyID = Request.QueryString["companyid"].ToString();
    }
    catch
    {}
   }
  }

2.在ASP/asp.net页面加载时,执行JS过程

<script language="javascript">
function PopulateData()
{
}   
</script> <body MS_POSITIONING="GridLayout" background="../../../Images/mailuserbg.gif">

<script language="javascript">
function SetCookie(sName, sValue)
{
 document.cookie = sName + "=" + escape(sValue) + "; ";
}
</script>
<body onload='setInterval("re()",(GetCookie("UDS_RefreshTime"))==null?30000:GetCookie("UDS_RefreshTime"))'>

<BODY onload='javascript: if(this.document.all.txtUsername.value=="") this.document.all.txtUsername.focus();else this.document.all.txtPassword.focus();'>


<body >

<body >

<body QUERY_STRING"].ToString() %>', '', 'toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no');close();">

3.asp.net页面中,服务器控件对JS过程的执行(2)

  <script language="javascript">
   function selQueryBatchEx(para,para1,para1,para2,para3,para4,para5)
   {
    var rtnVal = window.showModalDialog('../../selectform/SelectQueryBatch.aspx?opener=' + para+'&B='+para1+'&C='+para2+'&D='+para3+'&E='+para4+'&F='+para5,'','dialogwidth=600px;dialogheight=400px;status=no;edge=raised;scroll=no');
    if(rtnVal != null)
    {
     if(rtnVal.val2 == 'OK')
     {
      para.value = rtnVal.val1;
      document.forms[0].elements['txtBatch'].value=rtnVal.val1;
 &nbs