日期:2014-05-16  浏览次数:20631 次

又没有高手解决下,在线等!!!!!!
<html>
  <head>
  <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.6.2.min.js"></script>

  </head>
  
  <body>
  <a href='javascript:;' onclick="document.getElementById(d1).load('getEmpList1.php')">xxxx</a>
  <div id="d1"></div>
  </body>
</html>
错误:
d1 is not defined

------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">

        function doAction(index) {
            var ulObj = document.getElementById('u' + index);
            if (ulObj.style.display == 'none') {
                ulObj.style.display = 'block';
            } else {
                ulObj.style.display = 'none';
            }
        }
        $(document).ready(function () {
            $('#aaa').click(function () {
                $('#divRight').load('xxxx.php');
            });
        });
        
    </script>
   
</head>
<body style="font-size: 20px; font-style: italic;">
    <div id="d1v">
        首页</div>
    <div id="divRight">
        <h1>
            欢迎访问</h1>
    </div>
    <div id="divLeft">
        <ul>
            <li onclick="doAction(1);">xxxx</li>
            <ul id="u1" style="display: none;">
                <li><a href="#">xxx</a></li>
                <li onclick="doAction(3);"><a href="#">xxxx</a></li>
                <ul id="u3" style="display: none;">
                    <li><a href="#">xxxxx</a></li>
                    <li><a href="#">xxxx</a></li>
                    <li><a href="#">xxxxx</a></li>
                </ul>
                <li><a href="#">xxxx</a></li>
                <li><a href="#">xxxxx</a></li>
            </ul>
            <li onclick="doAction(2);">xxxxx</li>
            <ul id="u2" style="display: none;">
                <li><a href="#">xxxxx</a></li>
                <li><a href="#">xxxxx</a></li>
                <li><a href='javascript:;' id='aaa'>xxxx</a></li>
                <li><a href="#">xxxxx</a></li>
            </ul>
        </ul>
    </div>
    
</body>
</html>

------解决方案--------------------
探讨

$(document) is null
不行的 啊