鼠标经过显示alt或title内容,在网上拷了份js代码来用,关于IE和Firefox中javascript的,求各路高人指点问题1:我是在img 的 area 里加了title的文字说明 ,造成在IE里鼠标经过第一次会连代码都显示出来,移开再鼠标经过就不会出现了,每次重新打开都发生这种问题,如果但是img或者文字里加alt或title就不会出现这个问题,问题2:在ff里不兼容。。div不跟着鼠标走下面是代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body><img src="test.jpg" border="0" usemap="#Map" />
<map name="Map" id="Map">
  <area shape="rect" coords="51,90,144,221" href="#" title="1111111111<br>11111111"/>
  <area shape="rect" coords="268,86,374,228" href="#" title="2222222222<br>2222222"/>
  <area shape="rect" coords="535,90,649,228" href="#" title="3333333333<br>33333333"/>
</map><script>
var pltsPop=null;
var pltsoffsetX = 12;   // 弹出窗口位于鼠标左侧或者右侧的距离;3-12 合适
var pltsoffsetY = 15;  // 弹出窗口位于鼠标下方的距离;3-12 合适
var pltsPopbg="#000000"; //背景色
var pltsPopfg="#none"; //前景色
var pltsTitle="";
document.write('<div id=pltsTipLayer style="display: none;position: absolute; z-index:10001"></div>');
var ax_ts=document.getElementById("pltsTipLayer");
function pltsinits()
{
    document.onmouseover   = plts;
    document.onmousemove = moveToMouseLoc;
}
function plts(e)
{
if(e){o=e.target;MouseX=e.pageX;MouseY=e.pageY}
else{o=event.srcElement;MouseX=event.pagex;MouseY=event.pagey}
    if(o.title!=null && o.title!=""){o.dypop=o.title;o.title=""};
if(o.alt!=null && o.alt!=""){o.dypop=o.alt;o.alt=""};
    pltsPop=o.dypop;
    if(pltsPop!=null&&pltsPop!=""&&typeof[pltsPop]!="undefined")
    {
ax_ts.style.left=-1000;
ax_ts.style.display='';
var Msg=pltsPop.replace(/\n/g,"<br>");
Msg=Msg.replace(/\0x13/g,"<br>");
var re=/\{(.[^\{]*)\}/ig;
if(!re.test[Msg])pltsTitle="<span style='color:white;font-size:12px;'>『测试测试』</span>";
else{
  re=/\{(.[^\{]*)\}(.*)/ig;
     pltsTitle=Msg.replace(re,"$1")+"&nbsp;";
  re=/\{(.[^\{]*)\}/ig;
  Msg=Msg.replace(re,"");
  Msg=Msg.replace("<br>","");}
 var content =
 '<table style="FILTER:alpha(opacity=90);border: 1px solid #cccccc;" id="toolTipTalbe" cellspacing="1" cellpadding="0"><tr><td width="100%"><table bgcolor="#ffffff" cellspacing="0" cellpadding="0">'+
 '<tr id="pltsPoptop"><td height="20" bgcolor="#0094bb" style="line-height:18px;padding-left:5px;" ><p id="topleft" align="left"><span style="color:white;font-weight:bold;">↖'+pltsTitle+'</p><p id="topright" align="right" style="display:none">'+pltsTitle+'↗<span></td></tr>'+
 '<tr><td "+attr+" style="padding-left:10px;padding-right:10px;padding-top: 8px;padding-bottom:6px;line-height:140%">'+Msg+'</td></tr>'+
 '<tr id="pltsPopbot" style="display:none"><td height="20" bgcolor="#0094bb" style="line-height:18px;padding-left:5px;"><p id="botleft" align="left"><span style="color:white;font-weight:bold;">↙'+pltsTitle+'</p><p id="botright" align="right" style="display:none">'+pltsTitle+'↘<span></td></tr>'+
 '</table></td></tr></table>';
        ax_ts.innerHTML=content;
        document.getElementById("toolTipTalbe").style.width=Math.min(ax_ts.clientWidth,document.documentElement.clientWidth/2.2);
        moveToMouseLoc[e];
        return true;
       }
    else
    {
     ax_ts.innerHTML='';
       ax_ts.style.display='none';
        return true;
    }
}function moveToMouseLoc(e)
{
if(e){MouseX=e.pageX;MouseY=e.pageY;}else{MouseX=event.x;MouseY=event.y;}
if(ax_ts.innerHTML=='')return true;
var popHeight=ax_ts.clientHeight;
var popWidth=ax_ts.clientWidth;
if(MouseY+pltsoffsetY+popHeight>document.documentElement.clientHeight)
{
    popTopAdjust=-popHeight-pltsoffsetY*1.5;
 pltsPoptop.style.display="none";
 pltsPopbot.style.display=""; }
 else
{
 popTopAdjust=0;
 pltsPoptop.style.display="";
 pltsPopbot.style.display="none"; }
if(MouseX+pltsoffsetX+popWidth>document.documentElement.clientWidth)
{
 popLeftAdjust=-popWidth-pltsoffsetX*2;
 topleft.style.display="none";
 botleft.style.display="none";
 topright.style.display="";
 botright.style.display=""; }
else
{
 popLeftAdjust=0;
 topleft.style.display="";
 botleft.style.display="";
 topright.style.display="none";
 botright.style.display="none"; }
ax_ts.style.left=MouseX+pltsoffsetX+document.documentElement.scrollLeft+popLeftAdjust;
    if (navigator.userAgent.indexOf["MSIE"]<=0){
ax_ts.style.top=MouseY+pltsoffsetY+popTopAdjust;}
else{
    ax_ts.style.top=MouseY+pltsoffsetY+document.documentElement.scrollTop+popTopAdjust;}
   return true;
}
pltsinits();
</script>
</body> 
</html>