Mauricio,

the space after "/jmol-" concerns me.
Bob Hanson

Mauricio Carrillo Tripp wrote:

> Hi,
>
> I've been looking for an answer on other posts with no luck, is this 
> code supposed to work?
>
>              <script type="text/javascript">
>                 jmolInitialize("../jmol- 11.0.1/");
>                 jmolSetAppletColor("white");
>                 jmolApplet(512);
>                 jmolScript("load vdb/1stm.pdb;cpk off;wireframe 
> off;cartoon on;color structure;",0);
>              </script>
>
> If I include "load... ;... " on the jmolApplet it works fine, but as 
> it is it starts the applet but it doesn't load the molecule (no error 
> nor messages at all).

You should definitely see something in the Java console. Have you looked 
there? "jmolSetAppletColor("white") is pretty much deprecated. Just add

background white;

to your load script. There is no reason to use jmolScript right after 
jmolApplet. Better is to have:

                jmolInitialize("../jmol- 11.0.1/");
                jmolApplet(512, "background white;load vdb/1stm.pdb;cpk 
off;wireframe off;cartoon on;color structure;");

This presumes files are:


  parentdir/jmol- 11.0.1/JmolApplet0*.jar
  parentdir/thisdir/thispage.html
  parentdir/thisdir/vdb/1stm.pdb

That sound right?



> if I only load the molecule in jmolApplet, however, it loads it fine, 
> but "cpk off;..." in jmolScript is not run (no error nor messages at 
> all).
>
> Is there a special place/way to call jmolScript?
> Can I call jmolScript anywhere I want in the page (inside html script 
> tags or inside another js file <script src="./file.js" 
> type="text/javascript"></script>) after the applet starts?

yes and no: The first script you send is best sent from the jmolApplet() 
call itself, because then you can be certain that it is carried out at 
the correct time -- just after the applet is created.
You cannot use <script src="./file.js" type="text/javascript"></script> 
effectively "after the applet starts" because that would generally be 
the execution of JavaScript before the page document is complete. More 
likely you would have that just set up functions, and then later, say in 
hypertext links, have something like this:

<a href="javascript:jmolScript('........')">do something</a>


Check out the pages in 
http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11 and pages 
at http://jmol.sourceforge.net for examples.

Bob Hanson


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to