1、HTML命名规范类型命名对象命名代码DemoInput标签类型简写+P_+业务名(需求阶段已定义好)_+操作名(Add/Edit/Search等)+操作对象+命名text/passwordtxt<inputtype=”text”id=”txtSuppListName”>buttonbtn<inputtype="button"id=”txtSuppListName”>checkboxchk<inputtype="checkbox"id=”chkSuppListName”>radiordo<inputtype="radio"id="rdoSuppListIsStop"/>hiddenhid<inputtype="hidden"id="hidSuppListNo"/>filefle<inputtype="file"id="fleSuppFile"/>常用textareatxt<textareaid="txtSuppEditNote"></textarea>selectsel<selectid=”selSuppEditType”></select>optionop<optionid=”opSuppEditName1”></option>alnk<aid=”lnkSuppListName”></a>imgimg<imgid=”imgSuppListName”/>labellbl<lableid=”lblSuppViewName”></label>fontfnt<fontid=”fntSuppViewName”></font>buttonbtn<buttonid=”btnSunnListSearch”></button>容器标签(业务)命名(首字母小写)div<divid="editSupp"></div>ul<ulid="searchSupp"></ul>ol<olid="searchSupp"></ol>li<liid="searchSupp"></li>dd<ddid="searchSupp"></dd>dt<dtid="searchSupp"></dt>dl<dlid="searchSupp"></dl>table<tableid="searchSupp"></table>th<thid="searchSupp"></th>tr<trid="searchSupp"></tr>td<tdid="searchSupp"></td>tbody<dlid="searchSupp"></dl>thead<theadid="searchSupp"></thead>tfoot<tfootid="searchSupp"></tfoot>samp<sampid="searchSupp"></samp>span<spanid="searchSupp"></span>p<pid="searchSupp"></p>其他hr<hr/>br<br/>特殊命名所有用于查询的标签,类型简写后加’s’如:查询:txtsName,编辑:、HTML编写要求 要求只能使用上述规定的标签每个标签要求结构完整; 如:<span/>应写为:<span></span>除hr、br、img、input外标签都应该是标签对完整的<br/><hr/><img/>除容器和文字标签外,不允许在标签中放置内容。错误的写法:<inputtype="checkbox">库存</input>正确的应该是:<inputtype="checkbox"value="库存"></input>关于对象的样式设置应该尽量使用系统定义的样式,除特殊的情况。如:<tdstyle="text-align:right;font-size:12px;width:30px">1、JS命名规范类型命名对象命名代码Demo基础数据类型(类型简写+命名)stringstrvarstrSuppNameintivariSuppNodecmaildvardSuppNoarrayarrvararrSuppNamesdatedtvardSuppStopDateTimeJsonjsnvarjsnPostdata扩展StringBulidersbvarsbSuppName特殊对象类型object(class)命名常用局部变量"_"+类型简写(包括Dom)+命名var_strSuppName=‘’;全局变量类型简写(包括Dom)+命名varstrSuppName=‘’;function命名(首字母小写)functionaddSupp()functionparam类型简写(包括Dom)+命名(全小写)functionaddSupp(suppid)、JS注释规范类型命名对象命名代码Demo在编写js注释时,各对
Web前端开发-命名规则 来自淘豆网m.daumloan.com转载请标明出处.