Summary of permission verification, loop traversal, and hyperlink Logic Thinking

Source: Internet
Author: User

1. Permission Verification

1. Whether the Creator has the permission to operate (edit an article)

2. Whether the operated transaction is in the processing status (this article is in the editing Y and not editable N statuses)

That is:

String Msg = "NoPower ";

If (permission verification passed)

{

If (Edit = Y)

{

Msg = "succsss" // operation allowed

}

Else

{

Meg = "fail" // operation unavailable

}

}

Then, the view layer transmitted in Json performs corresponding operations and prompts Based on the accepted parameters.

Second, loop Traversal

1. Left and Right loops, that is: 1 2 at this time, it should be noted that when the number of singular loops is encountered, in order to ensure the page's aesthetics, it can be made up by repeating empty columns.

3 4

Cyclic Code

1 <table width = "100%" border = "0" cellspacing = "0" cellpadding = "0">
2 @ if (. Count ()> 0)
3 {
4
5 int I = 0;
6 for (; I <. Count ;)
7 {
8 <tr>
9 @ if (I <. Count)
10 {
11 <td> </td>
12 <td> </td>
13 I ++;
14
15 @ if (I <. Count)
16 {
17 <td> </td>
18 <td> </td>
19 I ++;
20}
21}
22
23 else {
24 <td colspan = "2">
25 & nbsp;
26 </td>
27}
28
29 </tr>
30
31}
32}
33 </table>

2. If each row shows three columns, you must make a judgment at the first and second columns, and add an empty column. (Colspan = "2" or colspan = "4)

3. obtain the corresponding value in a loop. If the value is obtained in checkbox or radiobutton, use jqurey to find the corresponding id or name.

Jquery Code

1 function ChooseEmp ()
2 {
3 var selectEmpID = ""; // cyclically traverse the checkbox and place it in the string
4 var selectEmpName = "";
5
6 $ ("# divEmp"). offsetParent ("table"). find ("input: checkbox"). each (function ()
7 {
8
9 if (this. checked = true)
10 {
11 // It is recommended that you do not use the short form. this is another method of selectEmpID + = $ (this). val () + ",";
12
13 // primary key Splicing
14 var selectValue = this. value;
15 selectEmpID + = selectValue + ",";
16
17 // name Splicing
18 var selectName = $ (this). parent (). next (). find ("label"). text ();
19 selectEmpName + = selectName + ",";
20}
21 });

Then, use Jquery to obtain the spliced string value. If the value is a pop-up window, it can be passed to the parent page, placed in a hidden field, and finally submitted to the entire Form.

Parameter transfer Code

1 // determine whether to select
2 if (selectEmpID = "")
3 {
4 alert ("Select ....! ");
5}
6 else
7 {
8 selectEmpName = selectEmpName. substring (0, selectEmpName. length-1)
9
10 // submit to the parent page
11 parent. $ ("# CaseEditempID"). val (selectEmpID );
12 parent. $ ("# CaseEditempName"). val (selectEmpName );
13
14 // display the span of the parent page
15 parent. $ ("# spanChooseEmpName" pai.html (selectEmpName );
16
17 // disable colorbox after the operation is complete
18 parent. $. fn. colorbox. close ();
19}

Third hyperlink:

1. The default anchor is # top, that is, the top of the web page

Javascript: void (0) only represents a link, but does not jump to the position

2. window. location. href = "" or window. open (url + "? ID = "+ value," _ blank ");

Related Article

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.