Code specification (reproduced)

xiaoxiao2021-03-06  120

I. Page Design Sections 1.IMG Control ALT: All display clauses must have text descriptions that can briefly describe the image content. 2. INPUT control MaxLength: All input controls require a MaxLength property, the default value is the length of the corresponding field in the database. Readonly: All non-changeable messages use the readonly property. 3.Form Control Action: All forms To specify an action if it is submitted to the specified action = "" Method: Perform irreversible action Using POST, reversible action Use GET OnSubmit: All FORMs must specify the check programs required before submission. All forms must have corresponding RESET Button. 4. Button Control OnClick: The Button for Submit in Form is not allowed to use this method, all data check through Form's onSubmit activation. 5.Title Attributes All pages must have the same Title as this page title. 6. The naming of the control uses the control type abbreviation (lowercase) English word (first letter capitalization) method. The control is basically involved in several types of Button: BTN Form: FRM SELECT: SEL TEXTAREA: TXT INPUT: IPT 7. Language Set All Chinese Pages: 8. The control attribute assigns all controls of the attribute value of all controls to include it. II. Client Program Section 1. Processing (2-1) All Error Information All Error Information All Error Information is used, and the punctuation uses the Chinese half-horn symbol, the format is as follows: "Error:" prompt information "!" 2. The process of successful reminder information (2-2) All successful information All successfully uses Chinese prompt success information, punctuation uses Chinese half-whale symbols, format as follows: "Success:" prompt information "!" 3. Return to the page to return Use history.back (); do not use history.go (-1); need to return to the previous N page (N> 1) Use History.go (-N); all returns use the connection method instead of button . 4. Decision of the Submitted Data Guaranteed by the data before submission, the data type and the length of the data are numbed by the length of the data: use the function isnan () length judgment: the length should be judged to remove the actual length after the front and rear spaces: all not Allowing the empty input field to determine after the front and rear spaces, if the field must not be empty if the query condition is not empty, if the condition is discovered, the error message is prompted by (2-1), then pass the method FOCUS () Focus the error field. 5. Delete the prompt before the data All involved in the deletion, and then perform a confirmation operation after the user selection.

III. Server-side program section 1. Number of data passes through GET, POST, and the data passed through TRIM before and after use before use. 2. Determination of data is required to perform empty, type, and length again through the parameter data obtained by Request. 3. Close Objects All databases and file objects must be as early as possible, simultaneously assign Nothing. 4. Tips Information All Error Tips Use the JavaScript prompt to ensure that the user does not see any internal error message. (Such as 1-1) involves the operation of the database Update, DEL, and INSERT to be prompted. (As 1-2) 5. Use of variables All variables need to be declared before use, and 6. Named of variables Adopt variable type abbreviation (lowercase) English word (first letter capitalization) method. The development variables are basically involved in several categories: I decimal: f Character: S Boo: B Date: D Special: Cycle use I, J, M, N; array with ARY pointer P, Q temporary variable TMP seven.sql Statements 1. Sort Order should be used to use the field sort of the establishment index or primary key. 2. Sense Select SELECT Avoid usage *, even if all fields are needed, try to list the order in accordance with the usage. 3. Try to avoid using IN and NOT IN 8. Test all pages to run at 800 * 600, 1024 * 768 two resolutions. All pages are running in IE5.0, 5.5 and 6.0 through without JavaScript errors.

*********************************************************** *************

Web Code Specification Preparation: WALAQI Chapter 1 ASP Coding Specification These ASP coding is divided into two parts, part of a static file code, part of which is a dynamic file encoding containing server-side scripts. Static file coding divided by Script coding and HTML encoding. Server-side coding is divided into server scripts, client scripts, and HTML scripts. The encoding specification adopts the following conventions: All client scripts will use the JavaScript all server-side scripts to use the VBScript static page output You use the HTML script This specification does not apply to the client script code generated by the server-side script. Chapter II Static File Coding Specification: The static file script part is written in JavaScript. The output section uses an HTML tag language. 1. HTML Markup Language Code Specification 1.1 Tagnote Specification: * A tag must occupy a row. There must be no two markers in the same row (except for the closing mark of the same mark), such as: TEXT must be written: Text 1.2 Tag Closed Specification * Static file content must be included in the tag * tag must be included in the tag * For tags that need to be closed, such as : <body> <table> <TR> <TD> <P> <textarea> <select> <font> <option> <div> <span> must appear at the same time. Such as <body> ... <p> ... <font> .... </ Font> .... </ P> ..... </ Body> * Do not appear in the cross-included statement, such as: <p> <font> .... </ p> </ font> 1.3 The attribute assignment specification specification for accepting the attribute, the attribute value must be surrounded by double quotation or single quotation. Such as: <body bgcolor = "red"> <font size = '7'> 1.4 Tagged Indent specification * The highest level of parent label is written in the left side of the top. * The next level marker is written in a TAB in a TAB in the next level, and the next level is pushed, and the left alignment is written to the parent labeling right. * The first character of the same level must be aligned. . 2. Client JavaScript Specification 2.1 Variable Naming Specifications * Constants and Global Variable Names must all use uppercase letters * Variable name first letters must be lowercase. * Variable Name must start using its type of writer.</p> <p>Various types of written strings are as follows: * Integer variable: int * long integer variable: LNG * floating point variable: flt * Double precision variable: DBL * Object reference variable: OBJ * string variable: str * Date Type variable: DTM * Variable name must be named after meaningful words, such as: strusername, LNGARRAYINDEX * Variable name except for the first letter, other words first characters must be capitalized * If the variable name can use words abbreviation, except for extensive understanding Outside the word abbreviation, all the variable names written by words must be given when defined, such as: var stradname // Name Var stradminname // does not have to give a comment, Admin STRADMINNAME // does not have to give an annotation, admin is widely used in 2.2 variables. Specification * must be defined before the variable is used. Unswormless use of * variables are prohibited to use * variables as miniature to small scopes. If FOR (VAR i = 0; i <12; i ) {} is used in recycling, VAR I; for (i = 0; i <12, i ) {} 2.3 object naming specification Various page objects such as Text input box , The button, the drop-down selection box must use the following corresponding prefix: * text input box: txt * button: btn * select drop-down selection box: SEL * OPTION Item: Opt * form form: fRM * frame frame: fra * hidden Table: HDN * DIV tag: div * span tag: span * dialog Object: DLG * Window object: Win 2.4 function and sub-process naming specification * Function Naming must use verbs noun pair, and enable functionality * The verb prefix named by the function must be the full verb * function of the function function. The first letter of the first word is named. The first letter of each word is capitalized in the third chapter of the three chapters. The static file HTML markup specification, reference (Chapter 2) 2. Client script Specification Dynamic file client script will use JavaScript writing, and must comply with the static file coding specification for JavaScript coding specifications (reference Chapter 2 Section 2) 3. Server-side script writing specification server-side scripts Writing 3.1 Naming specification 3.1.1 VBScript scripting variable naming specification * Constant and global variables must be used to use uppercase letters * constant must use const_ prefix * The global variable must use the G_ prefix * Variable name first letters must be lowercase. * Variable Name must start using its type of writer.</p> <p>Various types of written strings are as follows: * Integer variable: int * long integer variable: LNG * floating point variable: flt * Double precision variable: DBL * Object reference variable: OBJ * string variable: str * Date Type variable: DTM * Variable name must be named after meaningful words, such as: strusername, LNGARRAYINDEX * Variable name except for the first letter, other words first characters must be capitalized * If the variable name can use words abbreviation, except for extensive understanding In addition to the word abbreviation, all variable names written by words must be given when defined, such as: DIM stradname 'is used to represent the name of the Administrator account, DIM stradminname' does not have to give a comment, and Admin is a widely understood 3.1.2 object name. Specifications Various objects such as Connection, RecordSet, command must use the following corresponding prefix when named: * Conn * RecordSet object: RS * Command object: cmd * parameter object: param * Field object: FLD * Error object: Err 3.1 .3 function and child process naming specification * Function Naming must use verbs noun pairs, and enable functionality of function * Function named verb prefix must be the full verb * function related to function functions * function named first word Letters uppercase, back every word of each word 3.1.4 Common Variable Name Specification: Description: The portion included in [] is the omission part * Connection object: conn [name]. Name is a server name of the connected database * Recordset variable naming specification: RS [Name]. Name is a Customized English word combination related to RS storage * Command object: CMD [Name]. Name is a Customized English word combination related to a Command purpose * SQL statement string variable: strsql [commandname]. CommandName is a custom-related word combination with SQL statement features, such as: StrsqlupdateModify StrsqlinsertUser 3.2 code writing specification 3.2.1 Variables clearly declare principles * All ASP program files must contain <% Option Explicit% in the first line of code . Transfer to variables clearly declared mode 3.2.2 Character set setting principles * All ASP program files that will generate Chinese output to the client, must set Charset as "GB2312" prior to output. Such as: response.charset = "GB2312" 3.2 .3 function usage principles * Try to use the function package code block * Continuous code blocks should not exceed 50 lines. Do not exceed 70 lines * Try to use local variables. * If there is a global resource, such as Connection, try to incorporate the parameters of the function * All created in the function, you must turn it off before exiting the function. Such as: RecordSet, Command 3.2.4 Request, Session, Application Specification * All needs to be placed in session, Application objects, must use meaningful English name. In addition to the extensive word abbreviation, words should not be used.</p> <p>Such as: session ("cp") = strcurrentUserip 'does not allow session ("currentuserip" = StrCurrentUserip session ("pwd") = strpwd' Allow, PWD is widely understood as password * All required to use Request, Session Elements in Application must assign variables declared within the code in the code header. * If you get the content submitted in Form, you must use Request.form ("ItemName"). * If you get the content submitted in querystring, you must use the request.QueryString ("itemname") * must not appear in the code ("") Such a reference 3.2.5 HTML with server-side script hybrid use principles * Server-side script tag "<%" must be left aligned with the mark, such as: <table> <% do while not rs.eof%> <TR> <TD> Text </ TD> </ tr> <% rs.movenext loop%> </ table> * Server-side script tag "<%" is not allowed to write * "%> "You should not write * server-side script tag"%> "with its nearest" <% "tag, in accordance with its nearest" <% "tag,"%> ", in accordance with the HTML indentation rules of the server side, not follow the server End script indent rule * HTML tag internal code, according to the indentation rules of the server-side script, does not follow the HTML code indent rules Chapter 4 Common Error 1.1 Error Code: 80004005. 1.1.1 Error Description: Microsoft OLE DB Provider for ODBC Drivers Errors '80004005' Cannot start transaction in Firehose mode 1.1.2 Solution: When starting ADO transaction, you must first turn off record sets opened with the same connection object. Or before opening those cursor sets, set the cursor set position type as aduseclient. (Using the Client Tour Set) Chapter 5 Code habits Writing example 1. ADODB.Connection object 1.2 adoDb.command object 1.3 AdoDB. Recordset object 1.3.1 Create: set = server.createObject ("adoDb.recordset") rs.cursorlocation = aduseclient oopen strsql, conn, 1 [, 1] 'must specify a cursor type one, annotation specification A. Comment criteria : L Function Note Function Note refers to an annotation that explains the code itself. The comment is "'" as a unified annotation. 1. In-line annotation adopts the annotation symbol "'" example: DIM INTFILENO AS INTEGER' ファ ファ ル 号 号 is obtained 2. Target (including multi-line) Note Adoption of the comment block starts with the block end sign 36</p> <p>'********************************* "" ********************* *************************** L Revision Note Revision Note is the purpose of testing or changing the error, and the code is changed, but must This modification provides a description and wake-up target, and add the original code to the comment block. As long as there is a change, regardless of the single line or multi-line, it is clear that the block end flag is used to clear the sign modification section, which clearly explains the explanation, which is easy to find and distinguish a relatively large code segment. 15 15 '************** MODIFY START ****************' '*********** **** * *********. Requirements to Note: Declaring the definition part to annotate each constant declaration; for each variable, object, etc. Note; annotate each custom function definition; annotate each custom subroutine definition; the code section is done to each component, annotate at the top; annotate each condition selection branch; for each detailed design The key points mentioned are annotated; annotate the use of global variables;</p> <p>C. Note content: l The comments of variables and constant declarations are briefly described in line annotation methods.</p> <p>l Top of the top of custom functions and subroutines, etc.: '***************************************** ** 'Summary:' Function Description: 'Parameter Description:' Return Value: 'Note:' ************************************** *******</p> <p>l Interior of the code inside the L code indicates the computational rules of the specific code, the contents of the loop, the purpose of the counter, and the like.</p> <p>l Revised Note '********************************** The Revision:' Revision history: 'Revised Date' Original code: 'Case 5 to 8' ... case 4 to 8 '************** End **************</p> <p>D. Note: The code line can be added in the end of the row (cannot violate a wide range of lines); the annotation of a single line of code can add a simple note in "'" in the previous line; Before the code segment; the comment is uniformly adopted "'".</p> <p>Second, naming specification A. Passage VisualBasic reserved word can be seen according to the change in color in the VisualBasic designer. Variable Naming cannot use reserved words, you should use meaningful names, you should not use the referreditter ornamental name, such as A, X1, etc. Even for variables for loop count, it should also be given a meaningful name, such as longcnt, etc. Can't get too long, you should be as simple as possible, and the length restriction should be controlled within 32 characters. B. The constant uses uppercase letters to indicate that constant meaning nominal named, non-distinctive type: const defaultConcentration as single = 0.01</p> <p>C. Variable Naming must be used in case case (VB editor automatically converts to reduce program error) Variable naming with [Range Prefix] [Array Prefix] [Type Prefix] [Custom Name] control naming adopts [control prefix ] [Custom Naming] Variable Range Menu Spence Prefix Example G GstruserName Module M MstrUserName Process Range No struserName array prefix: a Type prefix:</p> <p>Examples of the data type prefix Boolean Bln BlnFoundByte Byt BytRasterDateCurrency Cur CurBalanceDate Dtm DtmBeginDateDouble Dbl DblFeeInteger Int IntQtyLong Lng LngVcIDSingle Sng SngAverageString Str StrItemIdObject Obj ObjRmtsvrADODB.Recordset Rst RstItemADODB.Connection Cnn cnnNewsPaperADODB.Command Cmm CmmAddCustomerVariant Vnt VntCheck custom type name prefix Udt UdtUserInfo control type control type prefix examples ADO Data ado AdoBiblioCheck box chk ChkReadOnlyCombo box, drop-down list box cbo CboEnglishCommand button cmd CmdExitCommon dialog dlg DlgFileOpenData-bound combo box dbcbo DbcboLanguageData-bound grid dbgrd DbgrdQueryResultData-bound list box dblst DblstJobTypeData combo dbc DbcAuthorData grid dgd DgdTitlesData list dbl DblPublisherDirectory list box dir DirSourceDrive list box drv DrvTargetFile list box fil FilSourceForm frm FrmEntryFrame fra FraLanguageGraph gra GraRevenueGrid grd GrdPricesHorizontal scroll bar hsb HsbVolumeImage img ImgIconImage combo imgcbo ImgcboProductImageList ils IlsAllIconsLabel lbl LblHelpMessageLine lin L inVerticalList box lst LstPolicyCodesListView lvw LvwHeadingsMenu mnu MnuFileOpenMonth view mvw MvwPeriodMS Chart ch ChSalesbyRegionMS Flex grid msg MsgClientsMS Tab mst MstFirstOption button opt OptGenderPicture box pic PicVGAProgressBar prg PrgLoadFileRemote Data rd RdTitlesSlider sld SldScaleSpin spn SpnPagesStatusBar sta StaDateTimeSysInfo sys SysMonitorTabStrip tab TabOptionsText box txt TxtLastNameTimer tmr TmrAlarmToolbar tlb TlbActionsTreeView tre TreorganizationUpdown UpddiRectionVertical Scroll Bar vsb vsbrate The prefix of the ActiveX control is specified by the design of the specific project. D. The tag tag is the code identifier used for GOTO jump, because GOT is not recommended, the label is used is more demanding. The label must be all uppercase, the middle space is used underline _ instead, and should be _-start, such as: _a_label_example: This definition tag is to distinguish from other code elements.</p> <p>E. Whether it is a function or subroutine, the method must be named by verb or verb phrases. There is no need to distinguish functions and subroutines, and there is no need to indicate the return type. Sub open (byval strcommandstring as string) function setcopyNumber (Byval INTCOPYNUMBER AS Integer) AS Integer parameter Need to indicate Byval or Byref, this is written to make the program grow, but it is necessary. If there is no special situation, use ByVal. Name method of the parameter, refer to the "Name Method for Variable". Third, writing format Specification A. Procedure's writing sequence This component's summary Note Description Variable Declaration Process Declaration Code Segment 1 Code Segment 2 ... b. Size write variable name prefix with lowercase, each word first letter with uppercase functions , The process, the object name also requires each constituent word word to write C. Adjust the unified development environment, set the development environment option for the VisualBasic designer, define the Tab width of 4. When the code is indent, first select the code block to be indented, and then use the shortcut to be Tab (right shift) and Shift Tab (left shift); if the manual input space completes the indentation, in 4 spaces. After the IF statement, indentation After the ELSE statement is retracted after the SELECT CASE statement, the correction after the CASE statement is retracted after the DO statement is retracted after the FOR statement, and the statement that has been divided by the row. Ind retains after the with statement. Index to the code that belongs to the row.</p> <p>D. Space operators must be spaced before and after, including: , -, *, /, ^, =,>,> =, <, <=, <>, not, and, or, e. Declaring Separation between partial and code statements; one blank line is inserted between various statement groups in which the unified task is executed. A good code should be composed of a process or related statement group arranged in a logical order. F. Pagewide pair longer statement, such as API declaration, etc., give a wrap within the code form visual range, do not allow others to see the full code by scrolling the window, and the single line code length does not exceed 95 columns. Use the "& _" wrap. G. Other in the project group, unify the VisualBasic development environment parameters as needed.</p> <p>Fourth, the code check code check is complete, named specification, clear classification, and credible code as qualified code. The inspection method finds that this coding specification is not followed unqualified;</p> <p>5. Suggemological specification L Some may need to violate a good programming principle, or use certain incomplete methods. When you encounter this, you must use detailed comments to explain what to do and why do you want to do this. A very high skillful code segment must be added detailed notes, do not let other developers spend a long time to study a high-tech but not understandable block. l Connect the comment to align it with the following statement. Note It is usually located in front of the code they want to explain. In order to highlight the relationship between the code and its code, then indent the comment, so that the code is in the same hierarchy, other ambiguity generated by the understanding of the document is incorporated by the project leader of the item that references this document. Unified explanation</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-125700.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="125700" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.040</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'l9caH3GgfR7aLf4GT_2Fx_2FOCLbrEe9Hh7l334cU45RKvtB8a_2FQ67zVMpkloCKWS3O4GBiujKy9XZocadj_2B_2B4qb6w_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>