ATTRIBUTE:  id

id="name"
 
The id attribute is used to assign a identifier value to a tag. Each id must be unique within the document and each element can only have one id.
 
In XHTML, the id attribute has essentially replaced the use of the name attribute. The value of the id must start with an alphabetic letter or an underscore. The rest of the value can contain any alpha/numeric chacracter.
 
Because it is unique, the value of the id can be the target of a URL or used to define a style rule.
 
There are four attributes common to most tags: class, id, style, and title.
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML id attribute Example</title>
</head>
<body>
<a href="#ckbx2">Go to Check Box Two</a>
<p />
<input type="checkbox" id="ckbx1" /> Check Box One
<p />
<input type="checkbox" id="ckbx2" /> Check Box Two
<p id="_mytext">
How now purple cow?
</p>
</body>
</html>

 
Output:
The use of id does not effect the output in any manner.


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information