<html>
<head>
<title></title>
<script src="jquery_1.4.2.js"></script>
</head>
<body>
<div id="mapbox" style="float:left;position:relative;overflow:hidden;width:1200px;z-index:1;">
<img id="pic" width="1200px" height="1973px" style="position:relative;z-index:-1;" src="images/all.png" />
</div>
<script>
$(function(){
var being=true;
var lx=645;
var ly=-870;
var title0= "西城区";
var text0 = "时间: 2012-03-24 19:20:13<br>设备名称: 0016EC12428";
//alert("lx-->>"+lx);
//$("#mapbox").append("<div style='position:relative;top:"+ly+";left:"+lx+";'>。</div>");
$("#mapbox").append("<div style='position:relative;top:"+(ly-10)+";left:"+(lx-13)+";'><img id='img0' src='images/.png' /></div>");//在图片显示用户输入的信息
$("#img0").mouseover(function(){
if(being == false) return;
being = true;
//添加提示框
$("#mapbox").append("<div id='img00' style='border:solid 1px;"+
"width=300;height:150;padding:10px;margin:0; position:relative;z-index:-1;"+
"top:"+(ly-131)+";left:"+(lx-23+0)+";'>"+title0+
"<button style='position:relative;top:-2px;'"+
"name='close' value='关闭' id='3d00' onclick='being=true;$(\"#img00\").remove();' />"+
"<br>"+text0+"</div>");
});
/*
$("#img0").mouseout(function(){
if($("#img00"))
$("#img00").remove();
});
*/
$("#img0").click(function(){
alert("0 - turn to 3d map");
});
var lxs=423;
var lys=-1519; $("#mapbox").append("<div style='position:relative;top:"+(lys-10)+";left:"+(lxs-13)+";'><img id='img1' src='images/.png' /></div>");//在图片显示用户输入的信息
$("#img1").mouseover(function(){
if(being == false) return;
being = true;
//添加提示框
$("#mapbox").append("<div id='img00' style='border:solid 1px;"+
"width=300;height:150;padding:10px;margin:0; position:relative;z-index:-1;"+
"top:"+(lys-131)+";left:"+(lxs-23+0)+";'>"+title0+
"<button style='width:17px;height:17px;position:relative;top:-2px;'"+
"name='close' value='关闭' id='3d00' onclick='being=true;$(\"#img00\").remove();' />"+
"<br>"+text0+"</div>");
});
/*
$("#img1").mouseout(function(){
if($("#img11"))
$("#img11").remove();
});
*/
$("#img1").click(function(){
alert("1 - turn to 3d map");
});
});
</script>
</body></html>      

解决方案 »

  1.   

    注销?是指:var being=true;改为var being;吗?我试了,不行的。
      

  2.   

    $("#img11").unbind('mouseover')
    试试
      

  3.   

    $("#img0").mouseover(function () {
                    
                    if (being == true) {
                        //添加提示框
                        $("#mapbox").append("<div id='img00' style='border:solid 1px;" +
                    "width=300;height:150;padding:10px;margin:0; position:relative;z-index:-1;" +
                    "top:" + (ly - 131) + ";left:" + (lx - 23 + 0) + ";'>" + title0 +
                    "<button style='position:relative;top:-2px;'" +
                    "name='close' value='关闭' id='3d00' onclick='being=true;$(\"#img00\").remove();' />" +
                    "<br>" + text0 + "</div>");
                                        }
                    being = false;
                });
    这样应该就能满足你的要求。
      

  4.   

    这样只能执行一次mouseover事件,在点击按钮关闭后,第二次就不能运行了。尽管being的值已经改为true。
      

  5.   

    if (!document.getElementById('img00'))
    先判断再添加
      

  6.   

    点击事件那把那个设为TURE。。
      

  7.   

    如果,你想第二次还可以运行你就在mouseover里加上楼上的判断或者在第一次运行后把being的值改为false
      

  8.   

    我说错了//初值
    being=false;你的判断改为
    if(being == true) return;//然后
    being=true;
      

  9.   

    onclick='being=true;$(\"#img00\").remove();'
    我试了下。。你这个事件没有触发啊
      

  10.   

     $("#img0").mouseover(function () {                if (being == true) {
                        //添加提示框
                        $("#mapbox").append("<div id='img00' style='border:solid 1px;" +
                    "width=300;height:150;padding:10px;margin:0; position:relative;z-index:-1;" +
                    "top:" + (ly - 131) + ";left:" + (lx - 23 + 0) + ";'>" + title0 +
                   "<button style='width:17px;height:17px;position:relative;top:-2px;'" +
                    "name='close' value='关闭' id='3d00' />" +
                    "<br>" + text0 + "</div>");
                    }
                    being = false;
                });            $('#3d00').live("click",function () {
                    alert('aa');
                being=true;
                $("#img00").remove();
                
                });
    这样应该就是你想要的结果