服务器控件与JavaScript
    我们用js访问服务器Button控件,
    Function AspButtonClick(){document.form1.Button1.value="我被单击了"; }
    这段js是放在<head></head>里的。
    <form ;

   看msdn的一个例子:
   <div>
    <p>
       <asp:ImageButton />
    </p>
    </div>

    protected void Page_Load(object sender, EventArgs e)
{
       Page.RegisterClientScriptBlock("MyScript", _
           "if (document.images) {" +
           "MyButton = new Image;" +
           "MyButtonShaded = new Image;" +
           "MyButton.src = 'button1.gif;" +
           "MyButtonShaded.src = 'button2.gif;" +
           "}" +
           "else {" +
           "MyButton = '';" +
           "MyButtonShaded = '';" +
           "}", true);

       ImageButton1.Attributes.Add("onmouseover",
          "this.src = MyButtonShaded.src;" +
          "window.status='是的!请单击此处!';");
       ImageButton1.Attributes.Add("onmouseout",
          "this.src = MyButton.src;" +
          "window.status='';");
    }
 
  protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
  {
     Label1.Text = "回发!";
  }

   -->
     <!--
     下面我们来看看js控制服务器控件CheckBoxList的示例。
    客户端生成的CheckBoxList
    <div>
        <table />
    </div>
    </form>
</body>
</html>

相关文章:

  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-18
猜你喜欢
  • 2022-12-23
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案