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
Now, more and more front-end developers are starti...
Types of joins 1. Inner join: The fields in the t...
How to turn a jar package into a docker container...
Solution-1: Download the msvcr100.dll file (find ...
Table of contents 1. Falling into the pit 2. Stru...
This article shares the MySQL 5.7.18 MSI installa...
This article uses an example to describe the erro...
Table of contents 1. Class 1.1 constructor() 1.2 ...
Preface MySQL master-slave replication is the bas...
I was curious about how to access the project usi...
After MySQL was upgraded to version 5.7, its secu...
1. Error details Once when manually performing a ...
Original article: Ultimate IE6 Cheatsheet: How To...
Preface I accidentally discovered that the half-h...
Preface Anyone who has learned JavaScript must be...