JavaScript Diagram Builder - Iframe Example

By using an iframe as _DiagramTarget you can put a diagram to a relative position within a webpage (for instance after text 1 and before text 2). With this there is no need anymore to use absolute positioned divs to keep the text outside of the diagram area. Test it by altering the width of your window and see how the diagram moves and does not overlap with the text. However take care: Although they belong to the HTML 4.0 standard, iframes are by now not supported by all web browsers.

This diagram was generated by
<iframe frameborder=0 scrolling="no" width=400 height=240 name="F1"></iframe>
<SCRIPT Language="JavaScript">
_DiagramTarget=window.frames["F1"];
_DiagramTarget.document.open();
_DiagramTarget.document.writeln("<html><head></head><body bgcolor='#eeeeee'>");
var D=new Diagram();
D.SetFrame(70, 30, 380, 200);
D.SetBorder(10, 50, 0, 4);
D.SetText("X-Label","Y-Label","Title");
D.Draw("#80FF80","#0000FF",true,"Click on me !","parent.F1DiagramClick()");
_DiagramTarget.document.writeln("</body></html>");
_DiagramTarget.document.close();
function F1DiagramClick(){ alert("Use your own function here."); }
</SCRIPT>

« Dynamic Example Relative Position »