SVG java.html的超链接
Hyperlink to SVG java/html
我一直在尝试将一个超链接与从amcharts.com下载的java地图上的一个SVG关联起来。代码是:
// svg path for target icon
var targetSVG = "M9,0C4.029,0,0,4.029,0,9s4.029,9,9,9s9-4.029,9-9S13.971,0,9,0z M9,15.93 c-3.83,0-6.93-3.1-6.93-6.93S5.17,2.07,9,2.07s6.93,3.1,6.93,6.93S12.83,15.93,9,15.93 M12.5,9c0,1.933-1.567,3.5-3.5,3.5S5.5,10.933,5.5,9S7.067,5.5,9,5.5 S12.5,7.067,12.5,9z";
targetSVG.onclick = function() {
self.location.href = "http://www.google.com";
}
<link rel="stylesheet" href="../ammap/ammap.css" type="text/css">
<script src="../ammap/ammap.js" type="text/javascript"></script>
<!-- map file should be included after ammap.js -->
<script src="../ammap/maps/js/worldLow.js" type="text/javascript"></script>
<!-- scripts for exporting chart as an image -->
<!-- Note, the exporting will work only if you view the file from web server -->
<!-- Exporting to image works on all modern browsers except IE9 (IE10 works fine) -->
<!--[if (!IE) | (gte IE 10)]> -->
<script src="../ammap/exporting/amexport.js" type="text/javascript"></script>
<script src="../ammap/exporting/rgbcolor.js" type="text/javascript"></script>
<script src="../ammap/exporting/canvg.js" type="text/javascript"></script>
<script src="../ammap/exporting/filesaver.js" type="text/javascript"></script>
<!-- <![endif]-->
<script type="text/javascript">
我正在为我为"targetSVG.onclick"创建的最后一个函数寻找解决方案,但它似乎不起作用。我是javascript和此类应用程序的新手。请帮忙。
Mushi
由于SVG图像显示在Ammap中,因此您可以利用可用的属性并将url插入单个点定义中。
一个例子:
var city = {
id: "city",
color: "#000000",
svgPath: targetSVG,
url: "http://www.google.com",
urlTarget: "_blank",
latitude: 41.872389,
longitude: 12.48018,
scale: 1.5,
zoomLevel: 7.74,
zoomLongitude: 12.48018,
zoomLatitude: 41.872389,
}
看看这个http://jsfiddle.net/aberna/L0h3eg74/1/演示
您可以在此处找到更多文档(http://docs.amcharts.com/javascriptmaps/MapObject)
相关文章:
- 制作一个不带HTML a标记但在动画播放完毕后指向其他页面的超链接
- 从JSON对象创建具有超链接的HTML表
- jQuery使用自定义select()自动完成:自定义HTML中的超链接
- 禁用来自另一个html页面的html框架的超链接
- HTML中js脚本中的超链接
- “data-”属性作为超链接的一部分.HTML 到 JavaScript
- 使用 jquery/javascript 从 iFrame 启用/禁用父元素的 HTML 超链接(对于给定的结构)
- 在 html 中添加超链接时,文本未正确截断
- 想要在我的 GWT 应用程序 (Java 7) 中为每个 http/https 超链接添加锚 html 标记
- 如何在另一个html文件中获取超链接ID
- 使用JavaScript和html将图像和超链接从一个位置随机移动到另一个位置
- 在html超链接中获取Rally应用程序
- 带有Javascript onclick事件的HTML超链接
- SVG java.html的超链接
- 在html中动态生成超链接
- HTML使文本可点击,而不使其成为超链接
- 使用php或java脚本或jquery在html页面上禁用所有超链接10秒
- 如何在HTML中创建条件超链接
- 如何将XML添加到具有超链接的HTML页面中
- 为同一张图片的某些部分设置超链接?(HTML)