【发布时间】:2013-03-05 07:14:35
【问题描述】:
当我点击红色圆圈时,窗口会弹出一次警报。 它在 Firefox 和 chrome 中运行良好,但在 ie8 中,它会弹出两次警报。 我该如何解决? 请在下面查看我的代码:
Raphael("world", 1000, 400, function () {
var r = this;
r.rect(0, 0, 1000, 400, 0).attr({
stroke: "none",
fill: "0-#9bb7cb-#adc8da"
});
var click = function(){
alert(this.type);
};
r.setStart();
var hue = Math.random();
for (var country in worldmap.shapes) {
r.path(worldmap.shapes[country]).attr({stroke: "#ccc6ae", fill: "#f0efeb", "stroke-opacity": 0.25});
}
var dot = r.circle(772.9870633333333, 166.90446666666668).attr({
title: "Point",
fill: "red",
stroke: "#fff",
"stroke-width": 2,
r: 5
});
var world = r.setFinish();
world.click(click);
});
【问题讨论】:
-
试试这个... var click = function(e){ e.stopPropagation();警报(this.type); };
-
感谢您的帮助,但它不起作用。
标签: javascript jquery internet-explorer-8 raphael vml