Home >Web Front-end >HTML Tutorial >Questions about custom attributes of html tags_HTML/Xhtml_Web page production

Questions about custom attributes of html tags_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:39:371626browse

In previous development, we always used the default HTML attributes, such as class, name, etc. I switched jobs to Huawei's outsourcing company and built a mall system using an open source framework. When coding, I encountered the following situation. There are many custom tags in the tags.

Copy code
The code is as follows:

src="_s" style="-ms-interpolation-mode:bicubic ;cursor:pointer;"
onclick="queryProductDetail(this);"
infoType=""
id=""
moduleId=""
chsDesc=""
engDesc=""
chsName=""
engName=""
onerror='checkImageFile(this);'
onload="DrawImage(this ,174,116)"/>

summarized a few points:

1. It has no impact on HTML JS. You can write n multiple attributes.

2. As long as the defined attribute name has the same name as the original default attribute.

3. This kind of custom attribute will not be parsed by the browser

4. JS can obtain its value through xxx.getAttribute("the attribute you wrote")

The benefits of this should be obvious. This should be used more in the future.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn