function ff(n)
{
var a=document.getElementById(n)a.onmousemove=kk(n);}function kk(l)
{var b=document.getElementById(l)b.className="tab_cur";
}本人 菜鸟一个 希望大家帮帮忙。 为什么 运行总是提示 有错误,,但是 把函数的参数去掉 换上具体的 如 document.getElementById("001") 就可以运行呢,很郁闷 希望大家帮忙看看。。

解决方案 »

  1.   

    function ff(var n)
    {
    var a=document.getElementById(n)a.onmousemove=kk(n);}function kk(var l)
    {var b=document.getElementById(l)b.className="tab_cur";
    }
      

  2.   

    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="[email protected]" />
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <style type="text/css">
    .tab_cur {
        color: green;
        background-color: red;
    }
        </style>
    </head>
    <body>
    <a id="test" href="#" target="_blank">Test Link</a>
    <script type="text/javascript">
    <!--ff("test");function ff(n)
    {
        var a=document.getElementById(n);
        a.onmouseover=kk;
    }function kk()
    {
        this.className="tab_cur";
    }
    //-->
    </script>
    </body>
    </html>
      

  3.   

    onmousemove 是控件的事件,只能赋予函数名,或匿名函数!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="[email protected]" />
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <style type="text/css">
    .tab_cur {
        color: green;
        background-color: red;
    }
        </style>
    </head>
    <body>
    <a id="test" href="#" target="_blank">Test Link</a>
    <script type="text/javascript">
    <!--ff("test");function ff(n)
    {
        var a=document.getElementById(n);
        a.onmousemove=kk;
        a.onmouseout=hh;
    }function kk()
    {
        this.className="tab_cur";
    }
    function hh()
    {
        this.className="";
    }
    //-->
    </script>
    </body>
    </html>
      

  4.   

    可以将a.onmousemove = kk(n);改为a.onmousemove = function() {
        kk(n);
    }