This message deals with the use of Jmol.js and attempts to answer
some questions that do not appear to be answered on the Jmol website
- at least not in the <http://jmol.sourceforge.net/jslibrary/> page.
In effect I am answering my own questions both in the hope that
Miguel will comment on mistakes, that they may be of interest to some
others, and that they may help initiate a revision of this page (in
which I will be more than happy to participate).
My general question is "If I use the Jmol.js library to provide
button control over the Jmol applet, can I still achieve the complex
css layout I have with chimebuttons and can I write W3C-compliant
code?"
The reasons for fearing the answer may be no were the non-compliant
nature of the form and script mark-up in the examples given, the fact
that rudimentary css and break methods were provided in the
javascript, and the possibility that both applet call and buttons had
to be in the same script block. Happily - at least if you have only
one applet on a page - this turns out not to be true. An example of
my success (which incidentally illustrates my problem of wanting to
script the controls so that they could reset the state of each other)
is to be found at:
<http://doolittle.ibls.gla.ac.uk/leader/jmolTests/jmolTest1.html>
which is the same design I use at:
<http://doolittle.ibls.gla.ac.uk:9006/david/servlet/ProteinMotifDB>
Comments on this page:
1. The DTD as html 4.01 strict is a bit of a cheat. Although the
source code validates, the page generated will have applet tags that
wouldn't have validated. However one point of validation is to pick
up errors which may throw browsers other than the one one is
developing in, so it is useful that this validates strict.
2. There are some absolute references to style sheets which Miguel
will not like. I was in a hurry this morning in the lab and didn't
bother to change them. As it happens I will be using absolute
references in the end as the pages are generated on the fly by a cgi
script and relative referencs fail.
General approach
The general approach is to have:
{html block}
{form tag open }
{scipt block with applet call}
{form tag close}
{html block}
{form tag open}
{script block with button calls}
{form tag close}
{html block}
As long as you close the script tags and enclose in a form the pages
work ok (at least on OSX Safari and Mozilla - I haven't tested on IE6
windows)
More specific description
In the page indicated I wish to have text spanning the whole page (in
practice a pop-up), the applet in a left column (left div) below with
instructions below it, the buttons in a right column (right div),
and then below these two a bottom div (here just a claret-coloured
bar) spanning the whole. the body layout is in essence:
<body>
{html block with start of div of fixed width enclosing whole}
<div class="left">
<form action="">
<script type="text/javascript">
jmolInitialize("../jmol");
jmolApplet(size, load molecule script)
</script>
</form>
<div...>
Instruction stuff
</div>
<!-- end of left div-->
<div class="right">
<form action="">
'start of table with headings and styles'
<tr><td>
<script type="text/javascript">
jmolCheckbox("script", "")
</script>
<td>'my own information instead of a label</td></tr>
....
</table>
</form>
</div> <!-- end of right div-->
<div class="footer">claret bar (hic)</div>
</body>
Comments on more specific description
1. The second checkbox argument is just "" so I can supply the
description where I wish.
2. I have marked up the script tags correctly as type="text/javascript".
3. I have supplied a redundant action="" for the open form tags so
that the page validates.
David
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users