Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <link rel="stylesheet" href="joint.css" />
- <script src="joint.js"></script>
- </head>
- <body>
- <div id="myholder"></div>
- <p>Enter names in the fields, then click "Submit" to submit the form:</p>
- <form id="frm1" action="form_action.asp">
- Text: <input type="text" name="content"><br>
- <input type="button" onclick="addButton()" value="Submit">
- </form>
- <script type="text/javascript">
- var graph = new joint.dia.Graph;
- var paper = new joint.dia.Paper({
- el: $('#myholder'),
- width: 1000,
- height: 800,
- model: graph,
- gridSize: 1
- });
- var rect = new joint.shapes.basic.Rect({
- position: { x: 100, y: 30 },
- size: { width: 100, height: 30 },
- attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
- });
- var rect2 = rect.clone();
- rect2.translate(300);
- var link = new joint.dia.Link({
- source: { id: rect.id },
- target: { id: rect2.id }
- });
- graph.addCells([rect, rect2, link]);
- function addButton(){
- var rect3 = new joint.shapes.basic.Rect({
- position: { x: 200, y: 50 },
- size: { width: 100, height: 30 },
- attrs: { rect: { fill: 'blue' }, text: { text: "go", fill: 'white' } }
- });
- graph.addCell(rect3);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement