The last time I mentioned the ASPNET control, I would like to mention that all the ASPNET controls will be generated by default and depend on something called viewstate, which is both good and bad, you can optimize viewstate based on your own needs, such as directly disabling or compressing viewstate.
In web development, JavaScript is definitely the King language of the client. Through the JS engine, it can operate Dom controls in a browser. How can it operate Dom controls? In fact, it is very simple, just a few steps:
1. Get the DOM control you want to manipulate;
2. assign values to the properties of the control you operate on;
It's that simple. Next, let's take a look at the corresponding explanations.
For example, we now have a div whose ID is div1. We need to hide this Div. What should we do? According to the above ideas, first obtain and then assign values.ProgramAs follows:
VaR DIV = Document. getelementbyid ("Div1");If(DIV) {Div. style. Display =False;}
Must it be simple? Some people say that this function is too simple. The whole process is the same with events and Ajax.
Below we have a dropdownlist. We need to execute Ajax when selecting an event in dropdownlist;CodeAs follows:
<Asp: dropdownlist id ="DDL"Runat ="Server"Onselect ="Ddl_select ()"/>FunctionDdl_select (){VaRSelect =Document. Getelementbyid ("DDL");If(! DDL)Return False;VaRValue = select. Options [select. selectedindex]. value;// This selected item ValueAjax_function (value );}FunctionAjax_function (ID ){// Send a request to the server segment by ID}
Is this simple? It is very simple to straighten out. Now it becomes an annoying question about how to know the attributes of the DOM control. Because there are too many Dom controls and there are many relative control attributes, don't worry, things will always solve. First, we only need to remember the commonly used ones. Second, we can use g. Third, we can download the relevant help documentation, or we can also use msdn, which is only in English, here we recommend a CHM document called "DHTML Manual (Lemon)", which can be downloaded. It is basically a lot of Chinese, because it is also quite simple and can be understood by everyone, there are also examples, but the home medicine for web development! What will I talk about next? It seems that the Web Front-end is enough for program developers ?! Let's talk about the next thing!