<ul>
<li><a href="javascript:doSent(this,'a.html?type=2');">问题</a></li>
</ul><script type="text/javascript">
function doSent(objA,path){
alert(objA.innerHTML);
}
</script>如上,我想通过传入this当前标签对象,然后对该对象进行操作
但经测试,alert(objA)是对象,但alert(objA.innerHTML)确实undefined请问如何实现操作该对象???
http://download.csdn.net/source/308916DHTML参考手册.rar
http://download.csdn.net/source/308913样式表中文手册.chm
http://download.csdn.net/source/304124
而应该定义 onclick 事件,此时 this 为指向控件自身!L@_@K
<!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>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head> <body>
<ul>
<li><a href="#" onclick="javascript:doSent(this,'a.html?type=2');">问题</a></li>
</ul><script type="text/javascript">
function doSent(objA,path){
alert(objA.innerHTML);
}
</script> </body>
</html>
楼主什么原因必须放在href中调用?
<a href="JavaScript:void(0);" onclick="doSent(this,'a.html?type=2');">问题</a>这样为什么不行呢?