Web coding specification

xiaoxiao2021-03-06  70

Preparation: WALAQI Chapter 1 ASP Code Specification These ASP codes are divided into two parts, part of static file coding, 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 custom-free English word combination * SQL statement string variable: strsql [CommandNam E]. 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 the cursor type PS ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1. Page design section 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.</p> <p>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: <meta http-equiv = "content-language" content = "en-cn"> <meta http-equiv = "content-type" content = "text / html; charset = GB2312"> 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.</p> <p>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.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-92658.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="92658" 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.037</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 = 'HiKxglDIodJVfRg7rLL0F78c1Lg_2B_2FR_2BhcRfTEgF9CLJt_2Bb51b7CcgKGKTgVicgWh7Q7PydPnawW_2Fa_2FCZgA766A_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>