如何与拉斐尔一起获取 paper.path NUMBER.js
how to get paper.path NUMBER with raphael.js
我正在使用以下代码:
var current = null;
for ( var state in aus) {
aus[state].color = Raphael.getColor();
(function(st, state) {
st[0].style.cursor = "pointer";
st[0].onmouseover = function() {
current && aus[current].animate({
fill : "#333",
stroke : "#666"
}, 500) && (document.getElementById(current).style.display = "");
st.animate({
fill : st.color,
stroke : "#ccc"
}, 500);
st.toFront();
R.safari();
document.getElementById(state).style.display = "block";
current = state;
};
st[0].onmouseout = function() {
st.animate({
fill : "#333",
stroke : "#666"
}, 500);
st.toFront();
R.safari();
};
if (state == "nsw") {
st[0].onmouseover();
}
})(aus[state], state);
}
从此页面: http://raphaeljs.com/australia.htm
我添加了这个:
st[0].onmousedown = function() {
paper.print();
var url = "index.php?cmd=2&sub=0";
window.open(url, "popup");
};
进入 for 循环以打开由 PHP 脚本生成的弹出窗口。
"sub"请求参数将是与状态关联的文件夹对应的数值,但我不知道如何将数字与它相关联。
假设每个状态都是一个从 0 到状态数的数字。
为什么不为每个州创建 id:
var ids = {}, i = 0;
for (var state in aus) {
ids[state] = i;
i++;
}
然后:
var url = "index.php?cmd=2&sub=" + ids[state];
相关文章:
- 使用 jQuery 的 .on 函数如何获取事件的原始元素
- jquery试图按名称获取按钮位置
- 如何在jQuery中获取元素的形式
- 如何在php文件中获取$.post-ajax传递的值
- 在Shopify中获取博客文章的图片
- 使用Javascript获取所选选项ID
- 在jQuery中获取表的行索引
- 使用jquery将mysql数据获取到新的表行中
- 在动态创建的元素上获取对特定选择器的引用
- 从城市名称获取惊喜
- Angular只从数组中获取所需的数据
- 无法将数据从firebase获取到我的html页面
- 从ajax请求中获取javascript对象
- 如何从画布上的某个移动事件中获取X和Y
- 是否有一个JS/jQuery函数可以获取某个类的每个元素的ID
- 如何在PHP中使用$_POST获取Select元素值
- 获取@ResponseBody的一部分作为主干和Spring MVC控制器之间的参数
- 从Rally获取一个特定的标记,以便计算另一个字段中的值
- 如何与拉斐尔一起获取 paper.path NUMBER.js
- paper.js:获取两个层/组的原始像素数据