svg和js交互
来源:互联网 发布:淘宝代购怎么找 编辑:程序博客网 时间:2024/06/14 05:38
//1使用xlink在svg文档中引入javascript:
//<?xml version="1.0" encoding="UTF-8"standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg"xmlns:xlink="http://www.w3.org/1999/xlink"
width="3.5in" height="1in">
<title>Listing 24-1 from the XMLBible</title>
<circle id="x" r="30" cx="34" cy="34"
style="fill: red; stroke: blue; stroke-width: 2"/>
<script type="text/javascript"xlink:href="a.js">
</script>
</svg>
2 在svg文档中内嵌入javascript代码:
<?xml version="1.0" encoding="UTF-8"standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg"
width="3.5in" height="1in">
<title>Listing 24-1 from the XMLBible</title>
<script type="text/javascript">
<![CDATA[
alert(123);
]]>
</script>
<circle r="30" cx="34" cy="34"
style="fill: red; stroke: blue; stroke-width: 2"/>
</svg>
<script type="text/javascript">
<![CDATA[
具体的js代码
]]>
3通过HTML 改变SVG中的属性
//<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document</title>
<meta name="generator" content="editplus"/>
<meta name="author" content=""/>
<meta name="keywords" content=""/>
<meta name="description" content=""/>
<script type="text/javascript">
<!--
var changeR = function (opration){
var svgDoc =document.getElementByIdx_x("svgmapctrl").getSVGDocument();
}
//-->
</script>
</head>
<body>
<embed width="300" height="300"type="image/svg-xml"
<input type="button" value="变大"onclick="changeR('+')"/> <inputtype="button" value="缩小" onclick="changeR('-')"/>
</body>
</html>
- svg和js交互
- SVG与JS的交互
- SVG与JS的交互
- 转载: SVG与JS的交互
- svg基础 6 动画和交互性
- SVG与html的交互(svg的js与html的js互调用)
- SVG与html的交互(svg的js与html的js互调用)
- SVG与html的交互(svg的js与html的js互调用)
- WebView和js交互
- JS 和IOS交互
- Android和JS交互
- UIWebView和js交互
- WebView和js交互
- UIWebView和Js交互
- webview和js交互
- webview和js 交互
- QWebView和js交互
- webview和js交互
- iframe加载完成
- 计算当前最大z-index
- svg引入
- svg 画箭头
- svg 画箭头2
- svg和js交互
- @Inheritance(strategy =&nbs…
- CodeForces 398A Cards
- javascript数组移出
- 字符串查找有多少个字母
- eclispe 快捷键
- 精简Oracle客户端+PLSQL Deve…
- sql数据库导入导出
- java计算当前时间和对比的过期时间…