MarvinView Example 2.1

Two downloaded and two inline molecules are placed into a 2x2 molecule table, each scaled to occupy 150x150 pixels. The cells are numbered from zero, in left to right, up to down order.

<script LANGUAGE="JavaScript1.1" SRC="../../marvin.js"></script>
<script LANGUAGE="JavaScript1.1">
<!--
mview_begin("../..", 300, 300);
mview_param("rows", "2");
mview_param("cols", "2");
mview_param("cell0", "|../../mols-2d/caffeine.csmol");
mview_param("cell1", "|O[C@H](\C=C\[C@@H](O)C1=CC=CC=C1)C2=CC=CC=C2");
mview_param("cell2", "|Ethane\n"
+"  Marvin  07119915552D\n"
+"\n"
+"  2  1  0  0  0  0  0  0  0  0999 V2000\n"
+"   -0.5625    1.2500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n"
+"   -0.5625    0.2500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0\n"
+"  1  2  1  0  0  0  0\n"
+"M  END");
mview_param("cell3", "|C[C@]12CC[C@@H]3[C@H](CC[C@H]4CC(=O)C(\C[C@]34C)=C\O)[C@@H]1CCC(=O)O2");
mview_end();
//-->
</script>

The "|" characters before the Molfile names/contents and SMILES strings are separator characters. They seem to be superfluous now, because each cell contains only one object, no need to separate anything. But you will see their significance in the forthcoming examples.

This is only a toy example. In reality, the greatest advantages of a molecule table over an html table with many small applets can be seen if you have a large number of molecules. This may be the case if the molecules are the result of a database search. 100 separate molecule applets consumes much more memory and are much slower then one molecule table with 100 molecules.


If you have a large number of molecules, it would be nice if the user would see some additional information next to the molecule. You will see how to do this and more in the next example.