In previous development, we used the default attributes of HTML, such as class, name, etc. I switched to Huawei's outsourcing company and developed a shopping mall system using an open source framework. When coding, I encountered the following situation. There are many custom tags in the tag. Copy code The code is as follows:<img msrc="<s:property value='#product.images'/>_m" src="<s:property value='#product.images'/>_s" style="-ms-interpolation-mode:bicubic; cursor:pointer;" onclick="queryProductDetail(this);" infoType="<s:property value='#product.unitType'/>" id="<s:property value='#product.unitID'/>" moduleId="<s:property value='#product.unitID'/>" chsDesc="<s:property value="#product.chsSimpleDesc"/>" engDesc="<s:property value="#product.engSimpleDesc"/>" chsName="<s:property value="#product.chsName"/>" engName="<s:property value="#product.engName"/>" onerror='checkImageFile(this);' onload="DrawImage(this,174,116)"/> Summarize a few points: 1. No impact on HTML JS. You can write multiple attributes. 2. Just make sure the name of the defined attribute is not the same as the original default attribute. 3. The browser will not parse this custom attribute 4. JS can get its value through xxx.getAttribute("the attribute you wrote") The benefits of this should be obvious. This should be used more often in the future. |
<<: How to avoid duplication of data when inserting in MySql batch
>>: CSS3 property line-clamp controls the use of text lines
Table of contents 1. Preliminary preparation 1.1 ...
Table of contents javascript tamper-proof object ...
MySql 8.0 corresponding driver package matching A...
Recent product testing found a problem that when ...
1. First introduce several commonly used MySQL fu...
Table of contents 1. State Hook 1. Basic usage 2....
Canal is an open source project under Alibaba, de...
As a front-end Web engineer, you must have encoun...
Table of contents iview-admin2.0 built-in permiss...
This article example shares the specific code of ...
Discuz! Forum has many configuration options in th...
The method of using CSS style to vertically cente...
Margin of parallel boxes (overlap of double margi...
Table of contents Preface background Big guess Fi...
This article shares the specific code of js canva...