Skip to content

Instantly share code, notes, and snippets.

@techird
Created October 28, 2013 10:40
Show Gist options
  • Save techird/7194731 to your computer and use it in GitHub Desktop.
Save techird/7194731 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
var ns = 'http://www.w3.org/2000/svg',
svg = document.createElementNS(ns, 'svg'),
div = document.createElement('div');
document.body.appendChild(div);
div.appendChild(svg);
svg.setAttribute('width', 400);
svg.setAttribute('height', 300);
svg.style.background = '#eee';
var line = document.createElementNS(ns, 'line');
svg.appendChild(line);
line.setAttribute('x1', 10);
line.setAttribute('y1', 10);
line.setAttribute('x2', 210);
line.setAttribute('y2', 210);
line.setAttribute('stroke', 'black');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment