本文共 972 字,大约阅读时间需要 3 分钟。
webform1.aspx.cs
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace work014{ public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "script1")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "script1", ""); } if (!ClientScript.IsStartupScriptRegistered(this.GetType(), "script2")) { ClientScript.RegisterStartupScript(this.GetType(), "script2", ""); } } /* * Page类的ClientScript属性,是ClientScriptManager的实例, * 其中方法RegisertClientScriptBlock是向客户端注册脚本的,注册的脚本位于附近。 * 只有了解了这一点,才可以让脚本的执行正确,运行网页后,查看代码,你可以看到结果。 */ }}
转载地址:http://uirm.baihongyu.com/