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

鼠标滑过出现提示层效果js代码 javascript(转)

演示

源码source code:

  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <htmlxmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
  5. <title>鼠标滑过出现提示层效果js代码javascript</title>
  6. <scripttype="text/javascript">
  7. functionenableTooltips(id){
  8. varlinks,i,h;
  9. if(!document.getElementById||!document.getElementsByTagName)return;
  10. AddCss();
  11. h=document.createElement("span");
  12. h.id="btc";
  13. h.setAttribute("id","btc");
  14. h.style.position="absolute";
  15. document.getElementsByTagName("body")[0].appendChild(h);
  16. if(id==null)links=document.getElementsByTagName("a");
  17. elselinks=document.getElementById(id).getElementsByTagName("a");
  18. for(i=0;i<links.length;i++){
  19. Prepare(links[i]);
  20. }
  21. }functionPrepare(el){
  22. vartooltip,t,b,s,l;
  23. t=el.getAttribute("title");
  24. if(t==null||t.length==0)t="link:";
  25. el.removeAttribute("title");
  26. tooltip=CreateEl("span","tooltip");
  27. s=CreateEl("span","top");
  28. s.appendChild(documen