version 1.1, 2008/07/01 09:12:33
|
version 1.2, 2008/07/01 11:02:49
|
Line 2
|
Line 2
|
<html>
|
<html>
|
<head>
|
<head>
|
|
|
<title>DragMath Latex Example</title>
|
<title>DragMath Equation Editor</title>
|
|
|
<script>
|
<script>
|
|
function insertAtCursor(doc, myField, myValue) {
|
|
//IE support
|
|
if (doc.selection) {
|
|
myField.focus();
|
|
sel = doc.selection.createRange();
|
|
sel.text = myValue;
|
|
}
|
|
//MOZILLA/NETSCAPE support
|
|
else if (myField.selectionStart || myField.selectionStart == '0') {
|
|
var startPos = myField.selectionStart;
|
|
var endPos = myField.selectionEnd;
|
|
myField.value = myField.value.substring(0, startPos)
|
|
+ myValue + '\n\n'
|
|
+ myField.value.substring(endPos, myField.value.length);
|
|
} else {
|
|
myField.value += myValue;
|
|
}
|
|
}
|
|
|
function renderLatex() {
|
function renderLatex() {
|
var ans = document.DragMath.getMathExpression();
|
var ans = document.DragMath.getMathExpression();
|
var source = '<html>'
|
var source = '<m>$'
|
+ '<body>'
|
|
+ '<h4>Latex Syntax: '
|
|
+ ans
|
|
+ '</h4>'
|
|
+ '<applet code="HotEqn.class" codebase="HotEqn" archive="HotEqn.jar" height="300" width="600" name="my equation">'
|
|
+ '<param name="equation" value="'
|
|
+ ans
|
+ ans
|
+ '"/>'
|
+ '$</m>';
|
+ '</applet>'
|
|
+ '</body>'
|
// var target = document.getElementById('outputID');
|
+ '</html>'
|
// var doc = target.contentDocument;
|
+ '';
|
|
|
var doc = opener.targetDoc
|
var target = document.getElementById('outputID');
|
var target = doc.getElementById(opener.targetEntry);
|
var doc = target.contentDocument;
|
insertAtCursor(doc, target, source);
|
if (doc == undefined || doc == null)
|
|
doc = target.contentWindow.document;
|
window.close();
|
doc.open();
|
|
doc.write(source);
|
|
doc.close();
|
|
|
|
|
|
}
|
}
|
Line 40 function renderLatex() {
|
Line 50 function renderLatex() {
|
|
|
|
|
<DIV align=left><FONT face=Arial color=#000080
|
<DIV align=left><FONT face=Arial color=#000080
|
size=6><STRONG>DragMath Latex Example</STRONG></FONT></DIV>
|
size=6><STRONG>DragMath Latex Equation Editor</STRONG></FONT></DIV>
|
<br><br>
|
<br><br>
|
|
|
<applet name="DragMath" codebase="classes" code="Display.MainApplet.class" archive="Project.jar,AbsoluteLayout.jar,swing-layout-1.0.jar,jdom.jar,jep.jar" width=540 height=333>
|
<applet name="DragMath" codebase="classes" code="Display.MainApplet.class" archive="Project.jar,AbsoluteLayout.jar,swing-layout-1.0.jar,jdom.jar,jep.jar" width=540 height=333>
|
Line 55 To use this page you need a Java-enabled
|
Line 65 To use this page you need a Java-enabled
|
<input type='button' value='Render Latex' onclick='renderLatex(); return true;' />
|
<input type='button' value='Render Latex' onclick='renderLatex(); return true;' />
|
</form>
|
</form>
|
|
|
<H2>Latex Rendering:</H2>
|
|
|
|
<iframe id='outputID' src='' width='98%' height='150'>
|
|
</iframe>
|
|
|
|
</div>
|
|
<br>
|
|
Latex rendering performed by freeware Java applet <a href="http://www.atp.ruhr-uni-bochum.de/VCLab/software/HotEqn/HotEqn.html">HotEqn </a>
|
|
</body>
|
</body>
|
</html>
|
</html>
|