User b22f714996
18-04-2005 08:47:05
Hello...
I tried the /jchem/marvin/sketch-applet.html example that comes with jchem.
Here's the code:
It works perfectly.
If I put this example from a different directory (say /testapplet/) the method call:
gives always 'undefined' as result. I put jmarvin.jar and marvin.jar as well as marvin.js in the /testapplet directory.
I have no idea why this is not working?
Any ideas?
Thanks a lot,
tobias
I tried the /jchem/marvin/sketch-applet.html example that comes with jchem.
Here's the code:
Code: |
<html> <head> <meta NAME="author" CONTENT="Peter Csizmadia"> <title>Sketch a Molecule</title> <script LANGUAGE="JavaScript"> <!-- //--> </script> </head> <body BGCOLOR="#ffffff" TEXT="#333366"> <center> <script LANGUAGE="JavaScript1.1" SRC="marvin.js"></script> <script LANGUAGE="JavaScript1.1"> <!-- function importMol() { if(document.MSketch != null) { var s = document.MolForm.MolTxt.value; s = local2unix(s); // Convert local line separator to "\n" document.MSketch.setMol(s); } else { alert("Cannot import molecule:\n"+ "no JavaScript to Java communication in your browser.\n"); } } function exportMol(format) { if(document.MSketch != null) { var s = document.MSketch.getMol(format); s = unix2local(s); // Convert "\n" to local line separator document.MolForm.MolTxt.value = s; } else { alert("Cannot import molecule:\n"+ "no JavaScript to Java communication in your browser.\n"); } } msketch_name = "MSketch"; msketch_begin(".", 100, 100); msketch_param("detach", "show,size=440x440"); msketch_param("background", "#ffffff"); msketch_param("molbg", "#ffffff"); msketch_end(); //--> </script> <form NAME=MolForm onSubmit="return false"> <table BORDER=0> <tr> <td><input TYPE=BUTTON VALUE="Write mol" onClick="exportMol('mol')"> </td> <td><input TYPE=BUTTON VALUE="Write compressed" onClick="exportMol('csmol')"> </td> <td><input TYPE=BUTTON VALUE="Write SMILES" onClick="exportMol('smiles')"> </td> <td><input TYPE=BUTTON VALUE="Read" onClick="importMol()"> </td> </tr> <tr> <td COLSPAN=4><textarea NAME="MolTxt" ROWS=20 COLS=70></textarea> </td> </tr> </table> </form> </center> </body> </html> |
It works perfectly.
If I put this example from a different directory (say /testapplet/) the method call:
Code: |
document.MSketch.getMol(format); |
gives always 'undefined' as result. I put jmarvin.jar and marvin.jar as well as marvin.js in the /testapplet directory.
I have no idea why this is not working?
Any ideas?
Thanks a lot,
tobias