在玩Raphael.js Australia map时,我尝试通过更改路径末尾的属性来为每个元素分配 URL:
country.cityone = R.path("coordinates").attr({href: "cityone.html"}).attr(attr);
country.citytwo = R.path("coordinates").attr({href: "citytwo.html"}).attr(attr);
...
以上适用于 Firefox、Chrome 等,但 IE6-IE9 无法使用该声明。
所以我想在之后声明另一个变量var country
并将网址分配给它:
var url = {};
url.cityone = "cityone.html";
url.citytwo = "citytwo.html";
然后在鼠标单击/向下时调用它:
st[0].onmousedown = function() {
current && country[current] && document.getElementById(“current”).appendChild(url);
};
但是,它根本不起作用。显然我没有从函数中正确调用,将每个 URL 与其各自的城市相关联。我错过了什么?