MarvinSketch Example - Retrieving a structure

Deprecated example

Press the 'Submit as Molfile' or the 'Submit as SMILES' button to retrieve the molecule from MarvinSketch in the specified format and post it to another page to display the structure in MarvinView.

When the form is submited, the molecule is posted to the display-result.jsp page.

    <script type="text/javascript" src="../../../marvin.js"></script>
    <form name="molform" method="post" action="../display-result.jsp">
            <input type="button" value="Submit as Molfile"
                onClick="getMol('mol')">
            <input type="button" value="Submit as SMILES"
                    onClick="getMol('smiles')">
            <input type="hidden" name="molecule">
    </form>

<script type="text/javascript">
<!--
function getMol(format) {
	if(document.MSketch != null) {
		var s = document.MSketch.getMol(format);
		document.molform.molecule.value = s;
		document.molform.submit();
	} else {
		alert("Cannot import molecule:\n" +
		"no JavaScript to Java communication in your browser.\n");
	}
}

msketch_name="MSketch";
msketch_begin("../../../",540,480);
msketch_param("mol","../../../mols-2d/caffeine.mol");
msketch_end();
//--></script>