Home

Example 4 - Export Buttons

This example extend example 1 adding an Export Button. These are similar to Export Areas only triggered by a button press, which calls a user define function with the export equation. Two buttons are created here to illustrate this behevior:


Key HTML Code

<!DOCTYPE html>
<html lang="en">
<head>
<title>Example 4 - Embedded Installation</title>

<!-- Scripts needed by CodeCogs Equation Editor -->
<link rel="stylesheet" type="text/css" href="http://latex.codecogs.com/css/equation-embed.css" />
<script type="text/javascript" src="http://latex.codecogs.com/js/eq_config.js" ></script>
<script type="text/javascript" src="http://latex.codecogs.com/js/eq_editor-lite-18.js" ></script>
<!-- End of Scripts needed -->

</head>
<body>
<h1>Example 4</h1>

<div id="editor"></div>
<textarea id="testbox" rows="3" cols="40"></textarea>
<img id="equation" />

<p>
<input id="copybutton" type="button" class="greybutton" value="Export Button 1" />
<input id="copybutton2" type="button" class="greybutton" value="Export Button 2" />
</p>
<textarea id="buttonexport" rows="3" cols="40"></textarea>

<script type="text/javascript">
EqEditor.embed('editor','');

var a=new EqTextArea('equation', 'testbox');
EqEditor.add(a,false);

EqnExport=function(text) { EqEditor.addText(document, 'buttonexport', text); };
EqEditor.ExportButton.add(a, 'copybutton', EqnExport, 'html');

EqnExport2=function(text) { alert(text); };
EqEditor.ExportButton.add(a, 'copybutton2', EqnExport2, 'html');
</script>


</body>
</html>

© 2004-2013 www.CodeCogs.com, Zyba Ltd.