fr wrote:

> I tried  to load a string from my database in the JmolApplet .
> The probleme is that the applet is loaded but apparently not the
> molecule in the applet.
>
> Any idea ?

There are several problems ...

> Code with jmol10 pre17
> ===================
> <html>
>    <head>
>      <title>nitrogens</title>
>      <script src="../jmol/Jmol.js"></script> <!-- REQUIRED -->
> <script language="JavaScript">
>       function init() {
>        var molecule;
>        molecule = document.TheForm.amol.value;
>        jmolLoadInline(molecule);
>        }
> </script>
>    </head>
>
> <body onload="init()">

Your technique of using an onLoad event handler to delay initialization is
a good idea ... but unfortunately it does not work.

The onLoad handler gets called before the applet is loaded. This means
that you are trying to call jmolLoadInline before the applet is loaded.
Therefore, JmolApplet.loadInline is not defined ... nor are any other
applet entry points.

We need to do something else ... see more comments below.

> <form name="TheForm">
> <input type="text" name="amol" value="REMARK  FINAL COORDINATES WRITTEN
> BY NAMD AT TIMESTEP 1000
> ATOM      1  C1  LIG     1       0.708  -1.202   0.152  0.00  0.00
> LIG
[snip]
> ATOM     40  H24 LIG     1      -0.221  -1.609   1.886  0.00  0.00
> LIG
> END">

Bob wrote that these lines had to begin with "|". That is one way to
handle it, but there is another option.

If you make this an <input> field, then you must introduce the |
characters because the browser will strip all newline characters from a
quoted tag attribute value .. in this case value="REMARK ... END"

However, if you change this to a <textarea> then newline characters will
be preserved.

<textarea name="amol">
REMARK ...
...
END
</textarea>

With a textarea the newline characters will be preserved and will be part
of the string.

However, <textarea> may not be what you want if this is part of a database
application and you want the molecular model file to be hidden.

> </form>
> <script>
> jmolSetCodebase("../jmol");
> jmolApplet(200, "");
> </script>
> </body>

I think that the solution you want is to use the function
'jmolAppletInline'. It will pass the molecular model file as a parameter
to the applet. Then the applet will load the model immediately after it is
initialized.


Separately, this issue of applet initialization is complicated. It is
going to keep causing trouble for people. I am going to try to see if I
can come up with a solution ... or at least something that gives better
diagnostics.

Miguel



-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Jmol-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to