<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请问如何实现操作该对象???

解决方案 »

  1.   

    补充说明:我是想获得链接对象,比如objA.innerHTML应该=“问题”另外如果我给该链接指定了ID,如何获得ID名字 ?
      

  2.   

    Web 开发常用手册JScript语言参考.rar
    http://download.csdn.net/source/308916DHTML参考手册.rar
    http://download.csdn.net/source/308913样式表中文手册.chm
    http://download.csdn.net/source/304124
      

  3.   

    不要在 href 上调用脚本时传入 this,此时 this 为 window 对象!
    而应该定义 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>
      

  4.   

    由于某种原因,我必须放在href内调用,有没有办法能获取到当前对象前提:不额外指定ID之类的
      

  5.   

    ]
    楼主什么原因必须放在href中调用?
    <a href="JavaScript:void(0);" onclick="doSent(this,'a.html?type=2');">问题</a>这样为什么不行呢?
      

  6.   

    传li在ul中的顺序号 n,再用getElementsByTagName('li')[n - 1]得到li