asp.net开发随笔

王朝asp·作者佚名  2006-11-24
宽屏版  字体: |||超大  

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 onload="PopulateData()" 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 onload="javascript:document.all.MsgSend.txtContent.focus()">

<body onload="document.getElementById('cbx_DeskTop').disabled=true">

<body onload="window.open('StaffData.aspx?'+'<%=Request.ServerVariables["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;

}

}

}

//以下过程和,在PageLoad中,用ImgSelBatch.Attributes.Add 等效

// this.ImgSelBatch.Attributes.Add("onclick","selQueryBatchEx('txtBatch','txtA','txtA','txtA','txtA','txtA');");

function SelectBatch(e)

{

if(event.srcElement.id=="ImgSelBatch")

{

return selQueryBatchEx('txtBatch','txtA','txtA','txtA','txtA','txtA');

}

}

document.onclick = SelectBatch;

</script>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有