Question about custom attributes of html tags

Question about custom attributes of html tags

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

Recommend

Use standard dl, dt, dd tags to discard table lists

Now, more and more front-end developers are starti...

Join operation in Mysql

Types of joins 1. Inner join: The fields in the t...

How to turn a jar package into a docker container

How to turn a jar package into a docker container...

MySQL 5.7.18 MSI Installation Graphics Tutorial

This article shares the MySQL 5.7.18 MSI installa...

Detailed explanation of error handling examples in MySQL stored procedures

This article uses an example to describe the erro...

Class in front-end JavaScript

Table of contents 1. Class 1.1 constructor() 1.2 ...

How to implement MySQL master-slave replication based on Docker

Preface MySQL master-slave replication is the bas...

nginx+tomcat example of accessing the project through the domain name

I was curious about how to access the project usi...

How to change the password of mysql5.7.20 under linux CentOS 7.4

After MySQL was upgraded to version 5.7, its secu...

An Uncommon Error and Solution for SQL Server Full Backup

1. Error details Once when manually performing a ...

IE6 BUG and fix is ​​a preventive strategy

Original article: Ultimate IE6 Cheatsheet: How To...

How to monitor and delete timed out sessions in Tomcat

Preface I accidentally discovered that the half-h...

Differences between this keyword in NodeJS and browsers

Preface Anyone who has learned JavaScript must be...