本帖最后由 cj205 于 2011-03-23 11:29:05 编辑

解决方案 »

  1.   

    这样可以吗
    <script type="text/javascript">
    window.onload = function()//页面加载完毕后自动调用该函数。
    {
    var menu = document.getElementById("menu").getElementsByTagName("li");for(i=0;i<menu.length;i++)
    {
    menu[i].onclick=function()
    {
    window.open("bbb.php?a="+menu[i].id);//如何把这句的a=0中的零换成一个变量来实现效果呢?现在点哪个菜单都只显示菜单一。
    }
    }
    }
    </script>
      

  2.   


    window.onload = function()//页面加载完毕后自动调用该函数。
    {
    var menu = document.getElementById("menu").getElementsByTagName("li");for(i=0;i<menu.length;i++)
    {
    menu[i].alt = i; //用一个属性来保存该变量
    menu[i].onclick=function()
    {
    window.open("bbb.php?a=" + this.alt);
    }
    }
    }
    这样可以吗。。