id:元素唯一标识
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Yeeku.H.Lee(CrazyIt.org)" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> id属性 </title>
</head>
<body>
<div id="show" style="width:400px;height:120px;background-color:red;"></div>
<a href="#" onclick="change();">改变颜色</a>
<script type="text/javascript">
var change = function()
{
var div = document.getElementById("show"); // ①
div.style.backgroundColor = div.style.backgroundColor == 'red'?
'green' : (div.style.backgroundColor == 'green'? 'blue': 'red');
}
</script>
</body>
</html>
style:用于为HTML元素指定css样式;
class:用于匹配css样式的class选择器;
<html>
<head>
<meta name="author" content="Yeeku.H.Lee(CrazyIt.org)" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> class属性 </title>
<style type="text/css">
div.content {
width: 300px;
height: 120px;
border: 1px solid black;
float:left;
}
</style>
</head>
<body>
<div class="content">测试内容一</div>
<div class="content" style="float:right">测试内容二</div>
</body>
</html>
dir:设置元素中内容的排列方向;
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Yeeku.H.Lee(CrazyIt.org)" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> dir属性 </title>
</head>
<body>
<div dir="ltr">测试内容dir设为ltr</div>
<div dir="rtl">测试内容dir设为rtl</div>
<table width="500" border="1">
<tr>
<td dir="ltr">表格内容dir设为ltr</td>
<td dir="rtl">表格内容dir设为rtl</td>
</tr>
<table>
</body>
</html>
title:为HTML元素指定额外信息;
<!DOCTYPE html>
<html>
<head>
<meta name="author" content="Yeeku.H.Lee(CrazyIt.org)" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> title属性 </title>
</head>
<body>
<a href="http://www.fkjava.org" title="疯狂软件官网">疯狂软件</a>
<div title="测试标题">测试内容</div>
<table border="1" >
<tr>
<td title="单元格标题">单元格内容</td>
</tr>
</table>
<table>
</body>
</html>
accesskey:指定激活该元素的快捷键
用户名(n):<input name="name" type="text" accesskey="n"/><br>
密码(p):<input name="pass" type="text" accesskey="p"/>
<a href="http://www.fkjava.org" accesskey="x">疯狂软件<a>
tabindex:用于控制窗口、HTML元素获取焦点的顺序
<a href="#" tabindex="2">疯狂Java联盟</a>
<a href="#" tabindex="1">HTML 5学习</a>
<a href="#" tabindex="3">Java学习</a>