Processing the client pop-up window

zhaozj2021-02-16  101

Sometimes I want to pop up a message in the client to prompt the user, not simply print a prompt message on the page, so that the page is not beautiful. The method of implementing the client pop-up message is simple, mainly binding events to buttons, or it can be implemented like MessageBox as in WIN FORM.

¹¹ With the button's Attribute property, the idea is to bind a Click event of the button with a JavaScript code.

?????: this.button1.attributes ["onclick"] = "JavaScript: return" ";

The front part of this code is this.button1.attributes ["onclick] this refers to the click attribute of the button, and the rear section refers to the trigger processing of the Click event, using a JavaScript script.

2 The second method is similar to the first, as follows:

Webform1.aspx.cs: this.button1.attributes.add ("onclick", "javascript: return test ()");

????? Webform1.aspx :?