Hi all,
I am looking at converting from Jmol to JSmol. The WIki page says ,
Modifying function calls from the format jmolXxxx(..., appletExtension) to
Jmol.jmolXxxx(appletID, ...)
So I have done that, and I am seeing undefined methods errors in the error
console:
TypeError: 'undefined' is not a function (evaluating
'Jmol.jmolInitialize('../nosession/jsmol')')
TypeError: 'undefined' is not a function (evaluating 'Jmol.jmolApplet([width,
height], jmolStartScript, jmolNum)')
Are these methods not supported in JSmol? Are there workarounds?
Here are the methods that I have used to initiate and run Jmol in the past. I
have a js page with the following code:
var jmolMols = new Array();
var addlScripts = new Array();
function setJmol(jmolNum, jmolMol, bgcolor, width, height, addlScript) {
jmolMols[jmolNum] = jmolMol;
addlScripts[jmolNum] = addlScript;
var bgcolor = bgcolor.replace('#', 'x');
// if color has format for use in HTML style attribute
if (!isNaN(parseInt(bgcolor, 16)))
bgcolor = 'x' + bgcolor; // if color is hexadecimal without x prefix
if (bgcolor.charAt(0) == 'x')
bgcolor = '[' + bgcolor + ']'; // if color is not English
var jmolStartScript = 'background ' + bgcolor
+ '; javascript jmolLoaded(' + jmolNum + '); ';
jmolApplet([width, height], jmolStartScript, jmolNum);
} // setJmol()
// this method will be called after the applet initialization is complete
function jmolLoaded(jmolNum) {
jmolLoadInline(jmolMols[jmolNum], jmolNum);
jmolScript(addlScripts[jmolNum], jmolNum);
} // jmolLoaded()
setJmol() is called by this script in the HTML, where I want the applet to
appear:
<script type="text/javascript">
// <!-- <% %>
setJmol(<%= jmolNum %>,
'<%= Utils.toValidJS(
figData[Figure.STRUCT]) %>',
'white', 250, 250,
'<%= Utils.toValidJS(
figData[Figure.JMOL_SCRIPTS])
%>');
// -->
</script>
The JSP page also has this call in its Javascript section:
Jmol.jmolInitialize('../nosession/jsmol')
-- Bob
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users