View Full Version : Load applet in page on function call

07-22-2011, 09:10 PM
Hi, I'm making a page and I'd like to start an applet (Jmol) and display it near the button of the current page when a button is clicked. However, I get a syntax error: "missing ; before statement"
(Note: this javascript is part of a cgi page)
The code I have is as follow:

<script type="text/javascript" SRC="../jmol-12.0.48/Jmol.js"></script>
function loadJmol(SMILES)
document.getElementById("viewMol").innerHTML = 'jmolInitialize("../jmol-12.0.48", true); jmolAppletInline(300, \'\', "load \$' + SMILES + '");' ;
print "<a href=javascript:loadJmol(\"SomeString\")>View</a>";
print "<script id=\"viewMol\"></script>";

The syntax error occurs at the single quote in ...").innerHTML = 'jmolInitialize("...

I have been able to get this applet to run when not in a function.

Has anyone run into this before and can give me a hand?

Thanks, Tom