score:1
Accepted answer
The script tag needs to go in the SVG file (game.svg) and not in the html file. Note that SVG script tags use xlink:href instead of src as the attribute that holds the script source.
<script xlink:href="game.js"></script>
You should also change onload="top.load(evt)"
to just onload="load(evt)"
in the root <svg>
element.
And your third and main issue is that you have a function zoom() and a variable called zoom on line 114. Remove the variable as it isnt used and the zoom method will get called.
Source: stackoverflow.com
Related Query
- Call JavaScript function from SVG file
- How to load a csv file from static in django into javascript function
- D3.js - Load data from CSV file and use it outside function call
- How to call javascript function from D3 button
- load JSON from rails controller to d3 .defer() function within javascript file
- Call custom made function from svg element using AngularJs and D3.js
- Can I call a JavaScript function on an iFrame or similar widget from Python?
- Javascript library d3 call function
- Export an SVG from DOM to file
- Trying to add ID to svg path from json file
- Receive Uncaught SecurityError when accessing SVG objects from Javascript
- How to call JavaScript libraries from TypeScript project?
- How to append javascript file to the body from javascript file which is in the same directory. Java server faces 2 JSF2
- How to add links from CSV file to SVG elements generated with D3?
- Create external JavaScript file and call it on HTML5 canvas
- d3 javascript click function call
- d3js v5: Create a SVG with groups from a JSON file
- How do I convert an svg file from inkscape to geoJson format
- Use elements from a predefined list as variables on a JavaScript function
- Javascript button onclick event to call function inside function in module
- Javascript d3 pie chart doesn't pull data from JSON file with list of dictionaries
- How to call a function with parameters from another function that has parameters?
- Microsoft Edge does not render SVG style elements on ajax call to a gzipped SVG file
- How to call JSON from a file instead of in-line for Multi-Edge D3 Example
- Link to generated download file from SVG
- Call Controller Function from Directive (with params passed from directive)
- Remove rect(s) of specific colour from svg - javascript
- D3 JavaScript return data value plus variable from anonymous function
- Javascript - Can not access array elements of an array created from a csv file
- How to pass input file parameter from html page to a Javascript
More Query from same tag
- Donut bubble chart in D3.js version 3
- Alternative to d3.ascending or d3.descending that achieves desired order
- Convertion from CSV to JSON in d3.js
- Checking group of boxes in an indented tree
- D3 - Appending SVG based on JSON Data
- Can I use JasperReports like D3.js?
- D3.v4 Projection Transition not Working
- Angular5 / Typescript - function is there but gone when try to call within a function
- bootstrap dropdown in svg with d3
- Tree drawing orientation
- D3 V4 ticks line x1 value
- Circle packing within force graph nodes in D3?
- D3.js, multiply element <g>
- d3.js NVD3 trigger tooltip manually
- X and Y axis are not together
- Migrating from D3.js V3 to V4 (and beyond) Error on svg.append
- How reference an svg class in css?
- Plotly/D3 – Reading data from CSV into separate traces
- x axis domain issue in D3 Line chart
- Javascript tree time-line
- How to make a chart in D3 work in node.js
- NVD3 line chart single record issue
- How to get abbreviated month name as X-axis in Linechart in DC.js
- Combining beeswarm with scalePoint
- Dimple.js Stacked Bar Graph
- How to switch csv dataset of d3.js graph to another csv by clicking on button
- d3js v7: add node to forceSimulation
- React + d3 force graph doesn't update position of last added node
- Get arrowheads to point at outer edge of node in D3
- D3 / change color of parent if child status is red or issue