Search notes:

SVG/JavaScript example: createElementNS

<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>createElementNS</title>

  <script type="text/javascript">

    var svgNS = "http://www.w3.org/2000/svg";  

    function main() {

      var svg = document.getElementById('svg').getSVGDocument().rootElement;

      for (var y=0; y<150; y+=5) {

        var line = document.createElementNS(svgNS, 'line');

        line.setAttributeNS(null, 'x1',   0);
        line.setAttributeNS(null, 'x2', 150);
        line.setAttributeNS(null, 'y1',   y);
        line.setAttributeNS(null, 'y2',   y);
        line.setAttributeNS(null, 'stroke', 'rgb(150,170,190)');
        line.setAttributeNS(null, 'stroke-width', 1.5);

        svg.appendChild(line);

      }

    }

  </script>
</head>
<body onload='main()'>

  Overlaying an svg object with blueish lines:<br>

  <object id="svg" type="image/svg+xml" data="inkscape-simple.svg"></object>

</body>
</html>
Github repository about-svg, path: /javascript/embedded/createElementNS.html

See also

SVG/JavaScript examples
SVG examples

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/design/g...', 1759422456, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/design/graphic/svg/examples/javascript/embedded/createElementNS(81): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78