写了一个弹出提示层的js,当放在html同一个页面的时候,效果一切正常,但是在<head>里用<script src="../js/pop.js" type="text/javascript"></script>引用的时候,其他浏览器都正常,但是在ie6下效果却出现了问题。
想请教下,这是什么原因?

解决方案 »

  1.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="../js/jquery-1.3.2.min.js" type="text/javascript"></script>
    <!--<script src="../js/pop.js" type="text/javascript"></script>-->
    <link href="style.css" type="text/css"  rel="stylesheet"/>
    <script type="text/javascript">
    $(document).ready(function(){
    var speed = 600;//动画速度
    $("#popIcon").click(function(event){//绑定事件处理
    event.stopPropagation();
    var offset = $(event.target).offset();//取消事件冒泡
    $("#popLayout").css({ top:offset.top + $(event.target).height() + "px", left:offset.left });//设置弹出层位置
    $("#popLayout").show(speed);//动画显示
    });
    $(document).click(function(event) { $("#popLayout").hide(speed) });//单击空白区域隐藏
    $("#popLayout").click(function(event) { $("#popLayout").hide(speed) });//单击弹出层则自身隐藏
    });</script>
    <title>无标题文档</title>
    </head>
    <body  style="margin:0px auto;width:700px;">
    <div class="SmallChart1">
      <div class="SmallChartTitle"><span class="smallChartTitleLeft fontBlack_12B">Buzz share</span><a href="#" id="popIcon"><img src="../images/iconQuery.gif" width="12" height="12" alt="" /></a> <span class="smallChartTitleRight">
        <select name="" class="options1">
          <option>2009-08</option>
          <option>2009-09</option>
          <option>2009-10</option>
        </select>
        <a href="#" class="funtion1">Export</a> </span> </div>
      <div class="SmallChartCon"><img width="398" height="198" src="../images/pic1.jpg" /></div>
    </div>
    <div id="popLayout" class="popLayout1">111111111111111111111111111111111111</div>
    </body>
    </html>如果把<script src="../js/pop.js" type="text/javascript"></script>这段注释取消,把页面内的代码注释掉,在ie6下问题就出现了。pop.js里面的js就是页面<script>里的这段