Simple application example of the attr () method and application example of the attr Method
The attr () method sets or returns the attribute value of the selected element. The working method varies according to different parameters of this method. Returns the attribute value of the selected element.
Page code:
HTML:
<Form action = "xxxxxx" method = "POST" id = "buy_form">
<Input type = "hidden" id = "paymethod" name = "paymethod" value = "directPay">
<Ul class = "ncc-payment-list">
<Li payment_code = "allstarpay" paymethod = "directPay"> ccccccc </li>
</Ul>
</Form>
JS:
<Script type = "text/javascript">
$ (Function (){
$ ('. Ncc-payment-list> li'). on ('click', function (){
$ ('# Paymethod'). val ($ (this). attr ('paymethod '));
});
});
</Script>
After clicking the li option on the page, directPay will assign the value of the li label property paymethod to the input label with id as paymethod.
The problem of jquery-202 for attr Method
Use $ ('selector '). prop ("checked"); // obtain the checked value of the selected item;
$ ('Selector '). prop ("checked",' "true"); // you can specify the checked value of the selected item;
This is enough.
Numerical Calculation Method: Simple Application of MATLAB
In the first question, we can consider using the fzero function. In the example, x = fzero (@ sin, 3) gets pi.
The second question should not directly use the interpolation function interp1. It is best to use linear fitting (the knowledge of physics tells us that the resistance value and temperature are linearly related) before interpolation calculation, use all data points to minimize the error. In essence, the interp1 function only uses two recent data points. Once there is a large error in the measurement of these two data points, the error of the output value will not be satisfactory, linear fitting can use all five data points to make it more scientific when the linear relationship between resistance and temperature is known.
T = [20.5, 32.7, 51.0, 73.0, 95.7];
R = [765,826,873,942,103 2];
P = polyfit (t, R, 1 );
R_60 = polyval (P, 60 );
R_60
Result:
R_60 =
906.0212