#2
melack2007-06-22 08:18
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Test</title>
<style type="text/css">
<!--
body {
margin-left: 0px;margin-top: 0px;}
div{
border:1px #CCCCCC solid; margin:100px; padding:5px; margin-top:100px}
#menu{
position:absolute; left:5px; height:400px; width:80px; font-family:"宋体"; font-size:12px; color:#2F3753;}
#menu dl dt{
list-style-type:none; text-align:center;}
.dt{
background:#999900;padding-top: 6px; padding-bottom: 5px; height:14px;}
#other{
position:absolute; left:180px; height:400px; width:600px;}
-->
</style>
<script language="javascript">
<!--
function init()
{
var nodeList = document.getElementsByTagName("dt");
for (var i = 0; i < nodeList.length; i++)
{
function __event()
{
// alert(node);
if(nodeList[i].className)
{
nodeList[i].className='';
}
else
{
nodeList[i].className='dt';
}
}
alert(nodeList[i]);
nodeList[i].attachEvent("onmouseover",__event);
nodeList[i].attachEvent("onmouseout",__event);
}
}
-->
</script>
</head>
<body onload="init();">
<div id="menu">
<dl>
<dt>Title 1</dt>
<dt>Title 2</dt>
<dt>Title 3</dt>
</dl>
</div>
<div id="other"><img width="600px" height="400px" src="#" alt="other" /></div>
</body>
</html>
我想用JAVASCRIPT将所有DT标签附上ONMOUSEOVER等属性为什么会提示对象为空.....谁能帮我看看~!