Questions tagged «dojox.gfx»

7
删除div中的所有子DOM元素
我有以下dojo代码可在div下创建曲面图形元素: .... <script type=text/javascript> .... function drawRec(){ var node = dojo.byId("surface"); // remove all the children graphics var surface = dojox.gfx.createSurface(node, 600, 600); surface.createLine({ x1 : 0, y1 : 0, x2 : 600, y2 : 600 }).setStroke("black"); } .... </script> .... <body> <div id="surface"></div> .... drawRec()将在第一次绘制矩形图形。如果我在这样的anchor href中再次调用此函数: <a href="javascript:drawRec();">...</a> 它将再次绘制另一个图形。我需要清除div下的所有图形,然后再次创建。我该如何添加一些dojo代码来做到这一点?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.