|
From: Grossman, R. B <rob...@uk...> - 2010-01-16 02:52:12
|
This one's not a hanging offense, but I started using script tags for my Jmol applets because I may have more than one per page, and each time I load a page now, I get an alert saying, "could not find applet jmolApplet0". It appears to be of no consequence, because the applets, whether there's one or more, load fine. At first I was naming my applets jmolApplet1, jmolAppet2, etc., so I changed them to jmolApplet0, etc., but I still get the message.
Here's the relevant part of the code:
<script type="text/javascript">
var jmolMol0 = '\n Marvin 03180516593D\n\n 22 22 0 0 0 0 999 V2000\n -0.4201 0.2577 -1.4146 C 0 0 0 0 0 0 0 0 0 6 0 0\n 1.0119 0.6024 -0.9257 C 0 0 2 0 0 0 0 0 0 5 0 0\n 1.4430 -0.3157 0.2489 C 0 0 2 0 0 0 0 0 0 4 0 0\n 0.4201 -0.2577 1.4146 C 0 0 0 0 0 0 0 0 0 3 0 0\n -1.0119 -0.6024 0.9257 C 0 0 0 0 0 0 0 0 0 2 0 0\n -1.4430 0.3157 -0.2489 C 0 0 0 0 0 0 0 0 0 1 0 0\n -0.7193 0.9460 -2.2082 H 0 0 0 0 0 0 0 0 0 0 0 0\n -0.4212 -0.7482 -1.8450 H 0 0 0 0 0 0 0 0 0 0 0 0\n 1.7207 0.5093 -1.7516 H 0 0 0 0 0 0 0 0 0 0 0 0\n 1.5221 -1.3462 -0.1098 H 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7193 -0.9460 2.2082 H 0 0 0 0 0 0 0 0 0 0 0 0\n 0.4212 0.7482 1.8450 H 0 0 0 0 0 0 0 0 0 0 0 0\n -1.7207 -0.5093 1.7516 H 0 0 0 0 0 0 0 0 0 0 0 0\n -1.0386 -1.6454 0.5961 H 0 0 0 0 0 0 0 0 0 0 0 0\n -1.5221 1.3462 0.1098 H 0 0 0 0 0 0 0 0 0 0 0 0\n -2.4331 0.0241 -0.6065 H 0 0 0 0 0 0 0 0 0 0 0 0\n 2.8389 0.0954 0.7531 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.0495 2.0704 -0.4618 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.3832 2.8404 -0.4618 C 0 0 0 0 0 0 0 0 0 0 0 0\n -0.2742 2.8574 -0.4618 C 0 0 0 0 0 0 0 0 0 0 0 0\n 4.1725 -0.6746 0.7531 C 0 0 0 0 0 0 0 0 0 0 0 0\n 5.4409 -0.0177 1.3286 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 1 6 1 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 5 6 1 0 0 0 0\n 1 7 1 0 0 0 0\n 1 8 1 0 0 0 0\n 2 9 1 0 0 0 0\n 2 18 1 0 0 0 0\n 3 17 1 0 0 0 0\n 3 10 1 0 0 0 0\n 4 11 1 0 0 0 0\n 4 12 1 0 0 0 0\n 5 13 1 0 0 0 0\n 5 14 1 0 0 0 0\n 6 15 1 0 0 0 0\n 6 16 1 0 0 0 0\n 17 21 1 0 0 0 0\n 18 19 1 0 0 0 0\n 18 20 1 0 0 0 0\n 21 22 1 0 0 0 0\nM END\n';
var bgcolor = 'white';
var height = 250;
var width = 250;
var addlScripts = 'set spin y 20; ';
</script>
<!-- method for displaying Jmol, http://jmol.sourceforge.net, in a jsp page
* Java variables must be defined in the host page:
* String pathToRoot
* String jmolJSCmds (semicolon-separated list of commands from Jmol Javascript library,
* http://jmol.sourceforge.net/jslibrary/ )
* int jmolNum
* JS variables must be defined in the host page:
* string variables jmolMol0, bgcolor, addlScripts (semicolon-separated list
* of Jmol scripting commands)
* int variables width, height
* Use <%@ include page="" %> in the host page.
-->
<script type="text/javascript">
// <!--
function jmolLoaded0() {
jmolLoadInline(jmolMol0, 'jmolApplet0');
jmolScript(addlScripts);
}
jmolInitialize('../nosession/jmol');
bgcolor = bgcolor.replace(/#/g, 'x'); // if color has format of HTML tags
if (!isNaN(parseInt(bgcolor, 16))) bgcolor = 'x' + bgcolor; // if color is hexadecimal only
if (bgcolor.charAt(0) == 'x') bgcolor = '[' + bgcolor + ']'; // if color is not English
var jmolStartScript = 'background ' + bgcolor
+ '; javascript jmolLoaded0(); ';
jmolApplet([width, height], jmolStartScript, 'jmolApplet0');
// -->
</script>
|