javascript及html编程规范

javascript及html编程规范

ID:16317826

大小:60.00 KB

页数:8页

时间:2018-08-09

javascript及html编程规范_第1页
javascript及html编程规范_第2页
javascript及html编程规范_第3页
javascript及html编程规范_第4页
javascript及html编程规范_第5页
资源描述:

《javascript及html编程规范》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、JavaScript及HTML编程规范JavaScript及HTML编程规范编号:ISS-STD-JS版本:1.08/8JavaScript及HTML编程规范变更记录日期版本变更说明作者8/8JavaScript及HTML编程规范目录1导言41.1目的41.2范围41.3角色和职责42HTML标记语言编码规范52.1标记的换行规范52.2标记的关闭规范52.3标记的属性赋值规范52.4标记的缩进规范62.5注释63客户端JavaScript规范73.1变量命名规范73.2变量使用规范73.3对象命名规范

2、83.4函数以及子过程命名规范83.5注释88/8JavaScript及HTML编程规范1导言JSP是一种脚本语言,编码分为两大部分,一部分为静态文件编码,一部分为包含服务器端脚本的动态文件编码。本规范是针对前者,即HTML和JavaScript编码的规范1.1目的本文档旨在提供一个编码的标准,以便所有HTML和JavaScript代码在产生的一开始就能够在整个开发团队中保持一致,从而能够更好的阅读和修改代码。1.2范围本文档适用于昭明海图公司项目开发团队的所有成员,为了使项目的后期维护和修改变得容易,

3、在每个项目开发中一定要遵守本文档中的规定术语定义1.3角色和职责编码负责人:本规范在具体项目中执行监督负责人。通过实施SourceReview制度,编程人员在完成自己的一个模块并提交测试前,由编码负责人进行SourceReview,不符合本编程规约的程序一律打回,重新修改,即编码人你认为自己的程序没有任何的功能问题。编码人员:本规范的遵守者8/8JavaScript及HTML编程规范1 HTML标记语言编码规范1.1标记的换行规范一个标记必须占用一行。不得出现两个标记在同一行的情况(同一标记的关闭标记除

4、外),如:   text  而必须写成:   text1.2 标记的关闭规范l静态文件内容必须包含在标记中间l标记必须包含在标记中间  l对于需要关闭的标记,如:     、、<body>、<table>、<tr>、<td>、<p>、<textarea>、<select>、<font>、<option>、<div>、<span>必须同其关闭标记</p><p>5、同时出现。如     <body>…<p>…<font>….</font>….</p>…..</body> 不得出现交叉包含的语句,如:   <p><font>…..</p></font>1.3标记的属性赋值规范对于接受属性的标记,属性值必须使用双引号包围。如:<body bgcolor=”red”> <font size=”7”>8/8JavaScript及HTML编程规范1.1标记的缩进规范l最高一级的父标记采用左对齐顶格方式书写。 l下一级标记采用左对齐向右缩进一个Tab的方式书写     l再下</p><p>6、一级依此类推,分别左对齐相对于父标记向右缩进一个Tab的方式书写 同一级标记的首字符上下必须对齐1.2注释<!---->8/8JavaScript及HTML编程规范1客户端JavaScript规范1.1 变量命名规范l常量以及全局变量名必须全部使用大写字母  l 变量名首字母必须小写。  l 变量名必须使用其类型的所写字符串开始。l各种类型的所写字符串如下:  n 整型变量:n   n 长整型变量:l   n 浮点型变量:f  n 双精度变量:d   n 对象引用变量:obj  n字符串变量:str  </p><p>7、 nDate类型变量:dt   n 变量名必须采用有意义的单词命名,如:   strUserName、lngArrayIndex n 变量名除首字母小写外,其他单词首字符必须大写n 如果变量名过长可以使用单词缩写,除了被广泛了解的单词缩写以外,所有使用单词所写的变量名必须在定义时给出注释,如:   uvar strAdName //用于表示Administrator帐户的名称   uvar strAdminName //不用给出注释,Admin被广泛了解1.2变量使用规范l变量使用前必须定义。没有定义的</p><p>8、变量禁止使用(虽然JavaScript中允许,但是做为全局变量)  l变量的使用尽量缩小到小的作用域。n如循环使用   for(var I=0;I<12;I++){//medthodbody}   而不是:   var I;  8/8JavaScript及HTML编程规范 for(I=0;I<12,I++){   //medthodbody}1.1对象命名规范各种页面对象如text输入框、按钮、下拉选择框在命名时必须使用以下对应前缀:l t</p> </div> <div class="mt-3 bg-white"> <div class="d-lg-block d-none px-3 px-lg-4 py-3 border-bottom text-center font-18"> 当前文档最多预览五页,下载文档查看全文 </div> <div class="detail-fixed-feature d-none d-lg-block" id="detailFixedFeatureBox"> <div class="px-3 px-lg-4 py-3 d-flex align-items-center justify-content-between fixed-feature-box" id="detailFixedFeature"> <div class="d-lg-flex d-none align-items-center"> <div> <a class="btn btn-outline-danger article-state" href="javascript:;" data-id="16317826" data-code="438274" data-title="javascript及html编程规范"> <span>侵权申诉</span> </a> <button type="button" class="btn btn-outline-secondary with-light ml-2" data-toggle="modal" data-target="#reportModal" data-id="16317826"><span>举报</span></button> </div> <nav class="d-flex align-items-center ml-4" id="anchorPoint"> <a href="javascript:;" class="btn btn-light anchor-pre px-2"><i class="iconfont text-muted"></i></a> <div class="text-muted mb-0 pre-point-list" id="prePointList"> <a class="px-2 active nav-link" href="#anchorImg0">1</a> <a class="px-2 nav-link" href="#anchorImg1">1</a> <a class="px-2 nav-link" href="#anchorImg2">2</a> <a class="px-2 nav-link" href="#anchorImg3">3</a> <a class="px-2 nav-link" href="#anchorImg4">4</a> <a class="px-2 nav-link" href="#anchorImg5">5</a> / <span class="px-2" id="prePageNums">8</span> </div> <a href="javascript:;" class="btn btn-light anchor-next px-2"><i class="iconfont text-muted"></i></a> </nav> </div> <div class="d-flex align-items-center"> <p class="d-lg-block d-none font-14 text-black-50 mb-0 mr-2">此文档下载收益归作者所有</p> <button class="btn btn-danger detail-download-btn px-3 ml-0 font-16" data-btn="downloadfile" style="width:128px;height:40px;" data-id="16317826" data-price="1000" data-size="60.00 KB" data-page="8页" data-type="doc" data-binddown="true" data-isold="new_content" data-vip="0" data-title="javascript及html编程规范">下载文档</button> </div> </div> </div> </div> <div class="d-block d-lg-none px-3 px-lg-4 py-3 border-bottom text-center font-14" style="color:#999">当前文档最多预览五页,下载文档查看全文</div> <button class="btn d-block w-100 d-lg-none btn-danger detail-download-btn px-3 ml-0 font-16" data-btn="downloadfile" data-id="16317826" data-price="1000" data-size="60.00 KB" data-page="8页" data-type="doc" data-binddown="true" data-isold="new_content" data-vip="0" data-title="javascript及html编程规范">点击下载本文档 </button> </div> <div class="px-3 px-lg-4 py-3 bg-white mt-3"> <ul class="nav custom-tab border-bottom" id="myTab" role="tablist"> <li class="nav-item" role="presentation"> <a class="nav-link active px-0 mr-4 font-16 font-weight-light pb-3" id="tips-tab" data-toggle="tab" href="#showTips" role="tab" aria-controls="showTips" aria-selected="true">版权提示</a> </li> <li class="nav-item" role="presentation"> <a class="nav-link px-0 pb-3 font-16 font-weight-light text-black-50" href="/d-16317826.html" >下载文档</a> </li> <dl class="flex-grow-1 mb-0 d-lg-none"> <li class="ml-3 float-right d-lg-none"> <button type="button" class="btn btn-light" data-toggle="modal" data-target="#reportModal" data-id="16317826"><span>举报</span></button> </li> </dl> </ul> <div class="tab-content with-content pt-3" id="myTabContent"> <div class="tab-pane fade show active font-14" id="showTips" role="tabpanel" aria-labelledby="showTips-tab"> 温馨提示: <br> 1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。<br> 2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。<br> 3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。<br> 4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。 <br> </div> </div> </div> </div> <div class="detail-sidebar d-none d-lg-block"> <div id="columnDetailSiderRight"> <div class="detail-yourlike mt-0 pb-2" id="relativeArticle"> <div class="border-bottom py-2 d-flex align-items-center justify-content-between"> <h5 class="font-16">相关文章</h5> <a class="font-14 hover-letter-spacing" href="/ucenter/search/index.html?text=javascript及html编程规范" target="_blank" rel="nofollow">更多<i class="iconfont font-12 pl-1"></i></a> </div> <ul class="font-14 like-list"> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-docx" href="/p-6127091.html" title="html css javascript 编码规范" target="_blank"><span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span><span class="text-danger">c</span><span class="text-danger">s</span><span class="text-danger">s</span><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span>码<span class="text-danger">规</span><span class="text-danger">范</span></a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-doc" href="/p-9498805.html" title="javascript 编程规范--." target="_blank"><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span><span class="text-danger">程</span><span class="text-danger">规</span><span class="text-danger">范</span>--.</a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-docx" href="/p-16058966.html" title="html css javascript 编码规范" target="_blank"><span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span><span class="text-danger">c</span><span class="text-danger">s</span><span class="text-danger">s</span><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span>码<span class="text-danger">规</span><span class="text-danger">范</span></a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-doc" href="/p-16144948.html" title="网页设计与制作(html+css+javascript)单元 javascript编程" target="_blank">网页设计与制作(<span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span>+<span class="text-danger">c</span><span class="text-danger">s</span><span class="text-danger">s</span>+<span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span>)单元<span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span><span class="text-danger">程</span></a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-doc" href="/p-16300190.html" title="html+css+javascript标签及属性" target="_blank"><span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span>+<span class="text-danger">c</span><span class="text-danger">s</span><span class="text-danger">s</span>+<span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span>标签<span class="text-danger">及</span>属性</a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-doc" href="/p-26256357.html" title="javascript编程语言的编码规范" target="_blank"><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span><span class="text-danger">程</span>语言的<span class="text-danger">编</span>码<span class="text-danger">规</span><span class="text-danger">范</span></a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-doc" href="/p-27783029.html" title="html、xhtml及javascript网页设计" target="_blank"><span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span>、x<span class="text-danger">h</span><span class="text-danger">t</span><span class="text-danger">m</span><span class="text-danger">l</span><span class="text-danger">及</span><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span>网页设计</a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-docx" href="/p-35478057.html" title="javascript编程规范-修订版" target="_blank"><span class="text-danger">j</span><span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span><span class="text-danger">s</span><span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span><span class="text-danger">程</span><span class="text-danger">规</span><span class="text-danger">范</span>-修订版</a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-ppt" href="/p-40846255.html" title="HTML与JavaScript" target="_blank">HTML与J<span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span>S<span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span></a> </li> <li class=""> <a class="text-ellipsis office-icon text-dark office-icon-ppt" href="/p-57011788.html" title="JavaScript编程基础及编程规范课件.ppt" target="_blank">J<span class="text-danger">a</span><span class="text-danger">v</span><span class="text-danger">a</span>S<span class="text-danger">c</span><span class="text-danger">r</span><span class="text-danger">i</span><span class="text-danger">p</span><span class="text-danger">t</span><span class="text-danger">编</span><span class="text-danger">程</span>基础<span class="text-danger">及</span><span class="text-danger">编</span><span class="text-danger">程</span><span class="text-danger">规</span><span class="text-danger">范</span>课件.<span class="text-danger">p</span><span class="text-danger">p</span><span class="text-danger">t</span></a> </li> </ul> </div> <div class="detail-yourlike pb-2"> <div class="border-bottom py-2"> <h5 class="font-16">相关标签</h5> </div> <ul class="font-14 like-list d-flex flex-wrap"> <a class="search-tag" href="/tags/14/" target="_blank">javascript</a> <a class="search-tag" href="/tags/1191713/" target="_blank">编程</a> <a class="search-tag" href="/tags/540337/" target="_blank">规范</a> </ul> </div> <script src="/d/js/acmsd/thea1.js"></script> </div> </div> </div> <footer> <div class="container d-none d-lg-block mb-4"> <div class="d-flex justify-content-between footer-nav"> <ul class="d-flex foot-nav"> <li> <h5>常见问题</h5> <a class=text-decoration-none href=/help/wenti/upload/ target=_blank> 关于上传 </a><a class=text-decoration-none href=/help/wenti/xiazai/ target=_blank> 关于下载 </a><a class=text-decoration-none href=/help/wenti/qinquan/ target=_blank> 关于侵权 </a><a class=text-decoration-none href=/help/wenti/fenxaing/ target=_blank> 分享文档赚钱教程 </a> </li> <li> <h5>关于我们</h5> <a class=text-decoration-none href=/help/about/wzjs/ target=_blank> 网站介绍 </a><a class=text-decoration-none href=/help/about/gywm/ target=_blank> 关于我们 </a><a class=text-decoration-none href=/help/about/lxwm/ target=_blank> 联系我们 </a> </li> <li> <h5>版权问题</h5> <a class=text-decoration-none href=/help/banquan/bqsm/ target=_blank> 版权声明 </a><a class=text-decoration-none href=/help/banquan/qqcl/ target=_blank> 侵权处理 </a><a class=text-decoration-none href=/help/banquan/mzsm/ target=_blank> 免责声明 </a> </li> <li> <h5>协议条款</h5> <a class=text-decoration-none href=/help/xieyi/yhxy/ target=_blank> 用户协议 </a><a class=text-decoration-none href=/help/xieyi/fwtk/ target=_blank> 用户服务条款 </a><a class=text-decoration-none href=/help/xieyi/ysbh/ target=_blank> 用户隐私保护 </a> </li> <li> <h5>网站导航</h5> <a class="text-decoration-none help-nav-item" href="/sitemaps.xml" data-name="网站地图" target="_blank">网站地图</a> <a class="text-decoration-none help-nav-item" href="/list.html" data-name="全部分类" target="_blank">全部分类</a> <a class="text-decoration-none help-nav-item" href="/sitemaps/index.html" data-name="资源地图" target="_blank">资源地图</a> </li> </ul> <div class="foot-qrcode d-flex"> <div> <div class="subsitute-bg"><img src="https://www.wenku365.com/d/file/2022/07-08/f23df57d987ef7ad9acb33fe5abf9854.jpg"></div> <p>关注公众号<br></p> </div> </div> </div> </div> <div class="footer-copyright"> <p><a href="/" target="_blank">天天文库</a>站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有【成交的100%(原创)】。</p> <p>本站是网络服务平台方,若您的权利被侵害,侵权客服QQ:3074922707 欢迎举报。</p> <p>Copyright 2004-2021 <a href="https://www.wenku365.com/" target="_blank">wenku365.com</a> All Rights Reserved <a href="https://beian.miit.gov.cn/#/Integrated/index" rel="nofollow" target="_blank">闽ICP备15016911号-5 </a></p> <p>闽公网安备 <a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=35052402000320" rel="nofollow" target="_blank">35052402000320</a></p> <p> <a href="https://www.wenku365.com/zt.html" target="_blank">专题文集</a> <a href="https://www.wenku365.com/zt-90007.html" target="_blank">丨职业培训</a> <a href="https://www.wenku365.com/zt-90005.html" target="_blank">丨实用范文</a> <a href="https://www.wenku365.com/zt-90010.html" target="_blank">丨商业材料</a> <a href="https://www.wenku365.com/zt-90013.html" target="_blank">丨合同协议</a> <a href="https://www.wenku365.com/zt-90009.html" target="_blank">丨PPT专题</a></p> </div> </footer> <script src="//static.wenku365.com/wenku365/js/global.min.js?"></script> <script src="//static.wenku365.com/wenku365/js/clipboard.min.js?"></script> <script src="//static.wenku365.com/wenku365/js/jquery.treeview.js?"></script> <script src="//static.wenku365.com/wenku365/js/jquery.share.min.js?"></script> <script src="//static.wenku365.com/wenku365/js/common.min.js?"></script> <script src="//static.wenku365.com/wenku365/js/downloadFile.js?"></script> <script src="//static.wenku365.com/wenku365/js/loginWindow.js?"></script> <script src="//static.wenku365.com/wenku365/js/windowRecharge.js?"></script> <script src="//static.wenku365.com/wenku365/js/viewer.min.js?"></script> <script src="//static.wenku365.com/wenku365/js/detail.js?"></script> <!-- 2023-05-06 22:10:12 --> </body> </html>