Any node within the body in HTML can be custom-defined, not including body, of course,
For example, the following code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
I can define a custom attribute III for an in-line position with ID s, with a value of 222, and it is obvious that III is not the basic attribute of the span element or even any other element, that is, those id,style, and so on, so there is no effect on the performance of the things within this node, But what is the point of doing this?This is primarily used to provide JavaScript with further action. Sometimes, an HTML is not as simple as the above, with a dynamic Web language php,jsp,asp.net Everything becomes complicated, you can set a label to the node you want to manipulate, through getattribute and setattribute operation. For example, write the following script for the above HTML page:
<script>var Span=document.getelementbyid ("s"), Alert (S.getattribute ("III") + ""), S.setattribute ("III", " 2222121 "), Alert (S.getattribute (" III ") +" ");</script>
Get the span node first, and then get its attribute value, and you must force the value of this property to be converted to a string to be able to eject normally.The value of the III property of the span node is then set to 2222121 and then ejected.
Operating effects such as:
Custom properties of any node within the "JavaScript" body