这段代码是从网上找的,<a>里的 class="a1"是什么意思?
son=hint alt="浮动提示内容"又表示什么?
小弟比较菜,请解释一下。
^_^

解决方案 »

  1.   

    class是css的样式?
    var oSon=window.document.getElementById(son); 是找dom中的id=son的,你的 
    程序中没有,肯定就是null了,这样的程序多了,看一个好一点的!
      

  2.   

    可是我看它原来的程序就是 son=hint 这样写的,可以出现提示。
      

  3.   

    在他的页面中肯定有一个id=son的div
    你查找一下吧,然后把这个DIV复制到你的页面中
      

  4.   

    Try..var oSon=window.document.getElementById(son);//为什么oSon总是null呢?
    ->
    var oSon = element.son;
      

  5.   

    to  ice_berg16(寻梦的稻草人):
         我找了,确实没有。to  wanghr100(灰豆宝宝.net) :
         这样写,提示不是浮动的,而是把原来网页的内容都变了。我是想实现http://www.rongshuxia.com/里面的文章列表浮动提示效果,可是怎么也不行。
      

  6.   

    问题解决了,下面贴出源代码,希望对需要解决问题的人有帮助。
    (共三个文件,放在同一目录下即可。)
    ____________________________________________________________________
    test.htm
    ____________________________________________________________________
    <head>
    <div align="left" id="divtip" style="width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px" id="divtip;display: none" style="display: none"></div>
    </head>
    <body>
          <a style="behavior:url(hint.htc)" son="divtip" alt="提示..." target="_blank"   href=""   >连接</a>
    </body>
    </html>
    ____________________________________________________________________
    hint.css
    ____________________________________________________________________
    .hint  {width:250px;border:1px solid #000000;background:#9FC383;position:absolute;z-index:1000;padding:4px;line-height:17px;}
    .onit  {behavior:url(hint.htc);}
    ____________________________________________________________________
    hint.htc
    ____________________________________________________________________
    <PUBLIC:PROPERTY NAME="son" />
    <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="onit()" />
    <PUBLIC:ATTACH EVENT="onmousemove" ONEVENT="onit()" />
    <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="noit()" />
    <SCRIPT>
    function onit() {
    alert("onit");
    var oSon=window.document.getElementById(son);
    if (oSon==null) {alert("null");return;}
    with (oSon) {
    innerText=alt;
    style.display="block";
    style.pixelLeft=window.event.clientX+window.document.body.scrollLeft+6;
    style.pixelTop=window.event.clientY+window.document.body.scrollTop+9;
    }
    }function noit() {
    var oSon=window.document.getElementById(son);
    if (oSon==null) return;
    oSon.style.display="none";
    }
    </SCRIPT>