Advertisement
Guest User

Untitled

a guest
May 28th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="joint.css" />
  6. <script src="joint.js"></script>
  7. </head>
  8.  
  9. <body>
  10. <div id="myholder"></div>
  11. <p>Enter names in the fields, then click "Submit" to submit the form:</p>
  12.  
  13. <form id="frm1" action="form_action.asp">
  14. Text: <input type="text" name="content"><br>
  15. <input type="button" onclick="addButton()" value="Submit">
  16. </form>
  17. <script type="text/javascript">
  18.  
  19. var graph = new joint.dia.Graph;
  20.  
  21. var paper = new joint.dia.Paper({
  22. el: $('#myholder'),
  23. width: 1000,
  24. height: 800,
  25. model: graph,
  26. gridSize: 1
  27. });
  28.  
  29. var rect = new joint.shapes.basic.Rect({
  30. position: { x: 100, y: 30 },
  31. size: { width: 100, height: 30 },
  32. attrs: { rect: { fill: 'blue' }, text: { text: 'my box', fill: 'white' } }
  33. });
  34.  
  35. var rect2 = rect.clone();
  36. rect2.translate(300);
  37.  
  38. var link = new joint.dia.Link({
  39. source: { id: rect.id },
  40. target: { id: rect2.id }
  41. });
  42.  
  43. graph.addCells([rect, rect2, link]);
  44. function addButton(){
  45. var rect3 = new joint.shapes.basic.Rect({
  46. position: { x: 200, y: 50 },
  47. size: { width: 100, height: 30 },
  48. attrs: { rect: { fill: 'blue' }, text: { text: "go", fill: 'white' } }
  49. });
  50. graph.addCell(rect3);
  51. }
  52. </script>
  53. </body>
  54.  
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement