-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-js.html
55 lines (31 loc) · 874 Bytes
/
test-js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Document sans nom</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
button {
font-size: 200%;
}
</style>
</head>
<body>
<object id="carte" width="400" height="300" type="image/svg+xml" data="carte1.svg"></object>
<button type="button">Click me</button>
<script>
var button = document.querySelector("button");
button.addEventListener("click", animate);
function animate() {
var svg = document.getElementById("carte");
var svgDoc = svg.contentDocument;
console.log(svgDoc);
var circle = svgDoc.getElementById("my-circle");
var bordure = svgDoc.querySelector(".st0");
// circle.setAttributeNS(null, "cx", 80);
bordure.setAttribute("style", "fill: red");
}
//
</script>
</body>
</html>