[英]How to change the dom in javascript from SVG to HTML page
So I have some Javascript and SVG embedded in my HTML page 所以我在HTML页面中嵌入了一些Javascript和SVG
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Channel Guide</title>
<script language="JavaScript" src="guide.js"></script>
</head>
<body style="text-align: center">
<embed id="svgtag" src="guide.svg" type="image/svg+xml" width="850" height="700" />
</body>
When I load the SVG file it calls a Javascript function in the js file called load() 当我加载SVG文件时,它在js文件中调用了Javascript函数load()
function load(evt) {
svgdoc = evt.target.ownerDocument;
fillData();
}
I can now use svgdoc to change the SVG DOM. 现在,我可以使用svgdoc更改SVG DOM。 The problem is that I want to change something in the HTML file, the width of the embedded SVG doc, using the Javascript file.
问题是我想使用Javascript文件更改HTML文件中的某些内容,即嵌入式SVG文档的宽度。 However the document variable points to guide.svg.
但是,文档变量指向guide.svg。
How do I edit the HTML file, or open it in a new DOM? 如何编辑HTML文件,或在新的DOM中打开它?
Thanks! 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.