Frog Frog Recommended: Web Code Specification

xiaoxiao2021-03-06  67

Web coding specification

Preparation: WALAQI

Chapter 1 ASP coding specification

ASP coding is divided into two parts, part of the 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 coding specification uses the following conventions:

All client scripts will be used in JavaScript

All server-side scripts will use VBScript

Static page output will use HTML scripts

This specification does not apply to client script code generated by the server-side script.

Chapter 2 Static file coding specification:

The static file script section is written in JavaScript. The output section uses an HTML tag language.

1. HTML tag language code specification

1.1 Marking Renewal Specification:

* A tag must take up a line. 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 Tags of Tags

* Static file content must be included in the tag

* tag must be included in 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 Tag properties assignment specification</p> <p>For tags that receive attributes, attribute values ​​must be surrounded by double quotes or single quotes. Such as:</p> <p><body bgcolor = "red"></p> <p><font size = '7'></p> <p>1.4 Tagged indentation specification</p> <p>* The highest level of parent label is written in the left side of the top.</p> <p>* The next level marker uses the left to right to turn right to write a TAB.</p> <p>In the next level, the left alignment is written in a TAB to the parent label, respectively.</p> <p>* The first character must be aligned above the same level.</p> <p>2. Client JavaScript specification</p> <p>2.1 variable naming specifications</p> <p>* Constants and global variable names must all use uppercase letters</p> <p>* Variable first letters must be lowercase.</p> <p>* Variable Name must start using its type of writer. Various types of writings are as follows:</p> <p>* Integer variable: int</p> <p>* Long integer variable: LNG</p> <p>* Floating point variable: flt</p> <p>* Double precision variable: DBL</p> <p>* Object reference variable: OBJ</p> <p>* String variable: STR</p> <p>* Date type variable: DTM</p> <p>* Variable names must be named after meaningful words, such as:</p> <p>StruserName, LNGARRAYINDEX</p> <p>* Variable name except the initial letters, other words must be capitalized</p> <p>* If the variable name can use word abbreviations, in addition to the extensive word abbreviation, all variable names written written by words must be annotated when defined, such as:</p> <p>Var stradname // is used to represent the name of the Administrator account</p> <p>Var stradminname // Don't give a notes, Admin is widely understood 2.2 variable usage specification</p> <p>* You must be defined before the variable is used. No defined variables are forbidden to use</p> <p>* Use of variables to narrow down to small scopes. Such as recycling</p> <p>FOR (var i = 0; i <12; i ) {</p> <p>}</p> <p>Instead:</p> <p>Var i;</p> <p>For (i = 0; i <12, i ) {</p> <p>}</p> <p>2.3 Object Naming Specifications</p> <p>Various page objects such as the Text input box, buttons, the drop-down selection box must use the following corresponding prefix when naming:</p> <p>* Text input box: txt</p> <p>* Button Button: BTN</p> <p>* SELECT drop-down selection box: SEL</p> <p>* Option item: OPT</p> <p>* Form form: FRM</p> <p>* Frame Frame: FRA</p> <p>* Hidden form: HDN</p> <p>* DIV tag: DIV</p> <p>* Span tag: span</p> <p>* Dialog Object: DLG</p> <p>* Window object: WIN</p> <p>2.4 Function and sub-process naming specification</p> <p>* Function Naming must use verbs noun pair, and enable functionality</p> <p>* The verb prefix named by the function must be the full verb related to the function function.</p> <p>* Function names the first letter lowercase of the first word, the first letter of each word</p> <p>Chapter 3 Dynamic File Coding Specification</p> <p>HTML writing specification</p> <p>HTML writing specification must comply with static files HTML markup specification, reference (Chapter 2, Section 1)</p> <p>2. Client script specification</p> <p>Dynamic file client scripts will be written in JavaScript and must meet the provisions of JavaScript coding specifications in static file coding specifications (refer to the second section of the second section)</p> <p>3. Server-side script writing specification</p> <p>Server-side script writing with VBScript writing</p> <p>3.1 Name Specification</p> <p>3.1.1 VBScript scripting variable naming specification</p> <p>* Constants and global variables must be used in uppercase letters</p> <p>* Constant must use const_ prefix</p> <p>* Global variables must use G_ prefix</p> <p>* Variable first letters must be lowercase.</p> <p>* Variable Name must start using its type of writer. Various types of writings are as follows:</p> <p>* Integer variable: int</p> <p>* Long integer variable: LNG</p> <p>* Floating point variable: flt</p> <p>* Double precision variable: DBL</p> <p>* Object reference variable: OBJ</p> <p>* String variable: STR</p> <p>* Date type variable: DTM</p> <p>* Variable names must be named after meaningful words, such as:</p> <p>StruserName, LNGARRAYINDEX</p> <p>* Variable name except the initial letters, other words must be capitalized</p> <p>* If the variable name can use word abbreviations, in addition to the extensive word abbreviation, all variable names written written by words must be annotated when defined, such as:</p> <p>DIM stradname 'is used to represent the name of the Administrator account</p> <p>Dim stradminname 'doesn't have to give an comment, and Admin is widely understood.</p> <p>3.1.2 Object Naming Specifications</p> <p>Various objects such as Connection, RecordSet, command must use the following corresponding prefix when naming:</p> <p>* Connection object: conn</p> <p>* Recordset object: RS</p> <p>* Command object: cmd</p> <p>* Parameter object: param</p> <p>* Field object: FLD</p> <p>* Error object: ERR</p> <p>3.1.3 Function and child process naming norm</p> <p>* Function Naming must use verbs noun pair, and enable functionality</p> <p>* The verb prefix named by the function must be the full verb related to the function function.</p> <p>* Function names the first letter of the first word, back every word of each word</p> <p>3.1.4 Common variable naming specifications:</p> <p>Description: The portion contained in [] is a canable portion * Connection object: conn [name]. Name is the server name for the connected database</p> <p>* Recordset variable naming specification: RS [name]. Name English word combination related to customized with RS storage</p> <p>* Command object: CMD [Name]. Name is a custom-related word combination related to COMMAND purposes</p> <p>* SQL statement string variable: strsql [commandName]. CommandName is a custom-dependent English word combination with SQL statements, such as:</p> <p>strsqlupdatemodify</p> <p>strsqlinsertuser</p> <p>3.2 Code Writing Specification</p> <p>3.2.1 Variables clearly declare principles</p> <p>* All ASP program files must contain <% Option Explicit%> in the first line of the code. Change to variables to clearly declare mode</p> <p>3.2.2 Character set setting principle</p> <p>* All ASP program files that will generate Chinese output to the client must set the charSet as "GB2312" before the output. Such as: response.charset = "GB2312"</p> <p>3.2.3 Function Use Principles</p> <p>* Try to use the function package code block</p> <p>* Continuous code blocks should not exceed 50 rows as much as possible. Do not exceed 70 lines</p> <p>* Try to use local variables.</p> <p>* If there is a global resource, such as Connection, try to introduce as a function of functions</p> <p>* All the open resources created inside the function must be turned off before exiting the function. Such as: Recordset, Command</p> <p>3.2.4 Request, Session, Application Specification</p> <p>* All the objects that need to be placed in session, Application must use meaningful English name. In addition to the extensive word abbreviation, words should not be used. Such as:</p> <p>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.</p> <p>* If you get the content submitted in Form, you must use Request.form ("ItemName").</p> <p>* If you get the content submitted in querystring, you must use Request.QueryString ("ItemName")</p> <p>* Request ("") in the code must not appear in the code.</p> <p>3.2.5 HTML with server-side script mixing principles</p> <p>* Server-side script tag "<%" must be left to the mark close 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 "<%" is not written in the same line with the same line</p> <p>* "%>" Do not write in the same line with the code in front of it</p> <p>* Server-side script tag "%>" is aligned with its nearest "<%" tag</p> <p>* HTML code inside the server is written in accordance with the HTML indentation rules of static files, and does not follow the server-side script indentation rules.</p> <p>* HTML tag internal code, according to the indentation rules of the server-side script, do not follow the HTML code indent rules</p> <p>Chapter 4 Frequent Error</p> <p>1. ADO's transaction</p> <p>1.1 Error Code: 80004005.</p> <p>1.1.1 Error Description:</p> <p>Microsoft OLE DB Provider for ODBC Drivers Errors '80004005' Cannot start transactions in Firehose mode</p> <p>1.1.2 Solution:</p> <p>When starting ADO's transaction, you must first turn off the record set that is opened using the same connection object, or set the cursor set position type as aduseclient before opening those cursors. (Using the client game set)</p> <p>Chapter 5 Code Customs Writing Example</p> <p>1. Use of ADO objects</p> <p>1.1 AdoDb.Connection object</p> <p>1.2 AdoDb.command object</p> <p>1.3 AdoDb.Recordset object</p> <p>1.3.1 Creation:</p> <p>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-91497.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="91497" 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.035</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 = 'j95xOjEz_2B8jYFRDgZtk0czLL76sCd9VutgugCYpH_2BPEED1lt1UTipIFmeef_2FJG_2B54g_2FYWZiuquUzCkhTe2MFTg_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>