Attributes usage in C #

Source: Internet
Author: User

I have studied the attributes usage in C # And it is very useful. The following is a summary:

The script method written in JS on the foreground can be used not only in the properties of the foreground control, but also in the background.

That is, when loading the background page, the js method is called. There are two syntax formats:

Method 1:Control ID. Attributes. Add ("event name", "js method ");

For example, a button control button1.attributes. Add ("onclick", "Return confirm ('OK? ')");

Another statement:Control ID. attributes ["event name"] = "js method ";

For example, the front-end writes a js method: function ischeck (){......};

Button1.attributes ["onclick"] = "ischeck ()";

You can also control attributes of a text box, such as the size and width of the text box.

For example, textbox1.attributes. Add ("width", "80px ");

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.