ASP coding specification

xiaoxiao2021-03-05  22

I saw having a lot of friends in discussing the Asp's question. I just had a norm. Let's refer to it, and organize your writing steps! ! Chapter 1 ASP coding specification 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. No two markers in the same line (except the close mark of the same mark), such as:

text

And must be written:

TEXT

1.2 Tag Turning 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></p> <p>It must be simultaneously appeared simultaneously with its shutdown tag. Such as</p> <p><body> ... <p> ... <font> .... </ font> .... </ p> .... </ body></p> <p>* No cross-included statements, such as:</p> <p><p> <font> ... .. </ p> </ font></p> <p>1.3 The attribute assignment specification of the tag is a tag that accepts the attribute. The attribute value must be surrounded by double quotation or single quotation. Such as:</p> <p><body bgcolor = "red"></p> <p><font size = '7'></p> <p>1.4 Tagged Indentation 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. 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 in words must be given when defined, such as: var stradname // is used to represent the name of the Administrator account.</p> <p>Var stradminName // Don't give an comment, Admin is widely understood</p> <p>2.2 Variable Use Specification * You must be defined before the variable is used. Unswormless use of * variables are prohibited to use * variables as miniature to small scopes. Such as recycling</p> <p>FOR (var i = 0; i <12; i ) {}</p> <p>Instead:</p> <p>Var i;</p> <p>For (i = 0; i <12, i ) {}</p> <p>2.3 Object Naming Specifications Various Page Objects such as Text Enter Boxes, Buttons, Drake Select boxes must be used when named: * Text input box: txt * button: btn * select drop-down selection box: SEL * OPTION Item: OPT * Form * 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 can reflect function of function * Function named verb prefix must be the full verb * function related to the function function, named the first letter of the first letter, the first letters of each word, the third chapter Dynamic file coding specification 1. HTML writing specification HTML writing specification must comply with static file HTML tag book writing specification, reference (Chapter 2) 2. Client script The dynamic file client script will use JavaScript writing, and must comply with static Document Coding Specification for JavaScript coding specifications (Reference Chapter 2 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 variable must All Using uppercase letters * constant must use const_ prefix * Global variables must use G_ prefix * Variable name first letters must be lowercase. * Variable Name must start using its type of writer. 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 naming specification: Description: The part contained in [> is the omission part * Connection object: conn [name ". Name is a server name for the connected database * Recordset variable naming specification: RS [Name>. Name is English word combination related to customized with RS storage * Command objects: CMD [Name>.</p> <p>Name is a custom-related word combination related to Command purposes * 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. Such as: session ("cp") = strcurrentUserip 'is not allowed</p> <p>Session ("currentuserip") = strcurrentUserip</p> <p>Session ("PWD") = strpwd 'Allow, PWD is widely understood as password</p> <p>* All Elements that need to be used in the code, session, Application elements must be assigned to the variable 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 usage * Server-side script tag "<%" must be left aligned with the mark next to the mark, such as:</p> <p><table></p> <p><%</p> <p>Do While Not Rs.eof</p> <p>%></p> <p><tr></p> <p><TD> TEXT </ TD></p> <p></ TR></p> <p><%</p> <p>rs.movenext</p> <p>loop</p> <p>%></p> <p></ TABLE></p> <p>* Server-side script tag "<%" Do not write * "%>" with its previous code, do not write * server-side script tag "%>" with its nearest " "Mark alignment * The HTML code inside the server side is written in accordance with the HTML indentation rules of the static file, and does not follow the server-side script indent rule * HTML tag internal code, according to the indentation rules of the server-side script, do not follow the HTML code indent Rules Chapter 4 Common Errors 1. ADO's Transaction 1.1 Error Code: 80004005. 1.1.1 Error Description: Microsoft OLE DB Provider for odbc drivers Error '' '' '' '' 80004005 '' '' '' 'Can't start the transaction in Firehose mode 1.1.2 Solution: In the start of ADO At the time, you must first turn off the record set opened by the same connection object, or set the cursor set position type as aduseclient. (Use the Client Tour Set) Chapter 5 Code Habit Writing Example 1. ADO object Use the 1.1 AdoDb.Connection object 1.3 adoDb.Command object 1.3 adoDb.recordset object 1.3.1 Create: SET RS = Server.createObject ("AdoDb.Recordset")</p> <p>rs.cursorlocation = aduseclient</p> <p>Rs.Open Strsql, CONN, 1 [, 1> "must specify the cursor type</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-35539.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="35539" 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 = 'z3X4JZgQ_2FI7e7yPOa7S_2B5Enl2nrCN4BbWRk8uAqjQVInVPAOqrjne2opAdifjOr66vJVqs5p8nIibeXWPwueXA_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>