Passing smiles of reactions to Marvin applet with JavaScript

User a216001020

18-01-2007 00:54:26

The following code doesn't work because of the '>>' substring of reaction smiles. Anyone can suggest a way to do it?





<script LANGUAGE="JavaScript">


function open_similar(id,smiles){


msgWindow=window.open('',id,'width=250,height=250')


msgWindow.document.write ("<HEAD><TITLE>" + id + "</TITLE></HEAD><body>")


msgWindow.document.write ("<center>" + id + "<br><applet CODEBASE=\"http://www.chemaxon.com/marvin\" ARCHIVE=\"jmarvin.jar\" CODE=\"JMView\" WIDTH=200 HEIGHT=200><param NAME=\"mol\" VALUE=" + smiles + "><strong>(YOU CANNOT SEE A JAVA APPLET HERE)</strong></applet></center>")


msgWindow.document.write ("</body></html>")


}


</script>


<a href=javascript:open_similar("Molecule","O=C1CCCCC1")>M1</a><br>


<a href=javascript:open_similar("Reaction","O=C1CCCCC1>>OC1CCCCC1")>M1 to M2</a><br>








Changing '>>' to '&gt;&gt;' also doesn't work.

User 870ab5b546

19-01-2007 15:55:49

perhaps you should try putting a backslash character \ in front of each >.

User a216001020

19-01-2007 16:17:04

It doesn't work...

User 870ab5b546

19-01-2007 16:54:06

Oh, I see. You need to put the smiles string after VALUE inside quotes:





msgWindow.document.write ("<center>" + id + "<br><applet CODEBASE=\"http://www.chemaxon.com/marvin\" ARCHIVE=\"jmarvin.jar\" CODE=\"JMView\" WIDTH=200 HEIGHT=200><param NAME=\"mol\" VALUE=\"" + smiles + "\"><strong>(YOU CANNOT SEE A JAVA APPLET HERE)</strong></applet></center>")

ChemAxon 7c2d26e5cf

21-01-2007 13:53:40

Bob is right.


Just one note.


Encoding of the '>' characters are also required in the URL:


Code:
<a href=javascript:open_similar("Reaction","O=C1CCCCC1&gt;&gt;OC1CCCCC1")>M1 to M2</a><br>