<!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=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
var is_creat=0;
function  creat_title()
{
   if(is_creat==0)
   {
   var img_left=event.clientX+document.documentElement.scrollLeft;
   var img_top=event.clientY+document.documentElement.scrollTop;
   var news_title=document.createElement("div"); 
   news_title.setAttribute("id","123"); 
   news_title.style.position="absolute"; 
   news_title.style.top=img_top; 
   news_title.style.left=img_left;                  // 左边距
   news_title.style.background="#095353";      // 设置背景颜色
   news_title.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=80,finishOpacity=75)"; 
   news_title.style.opacity="0.9";             // 设置透明度 
   news_title.style.width="450";              // 层宽度
   news_title.style.height="80";  
   news_title.innerHTML='<b><font color="#C42444" size="+3">你好啊 怎么不说话 啊</font></b>';   
   document.body.appendChild(news_title);  
   is_creat=1;
   } 
}
function update_title()
{
   var img_left=event.clientX+document.documentElement.scrollLeft;
   var img_top=event.clientY+document.documentElement.scrollTop;
   var news_title=document.getElementById("123");
   news_title.style.top=img_top; 
   news_title.style.left=img_left;
   //setTimeout("my_alert()",200);
}
function title_close()
{
   var news_titlle=document.getElementById("123");
   document.body.removeChild(news_titlle);  
}
</script>
<body>
<img src="http://c.csdn.net/bbs/t/5/i/pic_logo.gif" border="0" usemap="#Map" width="450" height="500">
<map name="Map" id="Map">
<area shape="rect" coords="2,0,152,457" href="#"  onmouseover="creat_title();" onmousemove="update_title();" onmouseout="title_close();"/>
</map>
</body>
</html>

解决方案 »

  1.   

    function  creat_title()
    {
       //if(is_creat==0)
       //{
       var img_left=event.clientX+document.documentElement.scrollLeft;
       var img_top=event.clientY+document.documentElement.scrollTop;
       var news_title=document.createElement("div"); 
       news_title.setAttribute("id","123"); 
       news_title.style.position="absolute"; 
       news_title.style.top=img_top; 
       news_title.style.left=img_left;                  // 左边距
       news_title.style.background="#095353";      // 设置背景颜色
       news_title.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=80,finishOpacity=75)"; 
       news_title.style.opacity="0.9";             // 设置透明度 
       news_title.style.width="450";              // 层宽度
       news_title.style.height="80";  
       news_title.innerHTML='<b><font color="#C42444" size="+3">你好啊 怎么不说话 啊</font></b>';   
       document.body.appendChild(news_title);  
       //is_creat=1;
       //} 
    }