Greetings (again, already)

   I've just found a fix for the problem I posted yesterday.

I am trying to develop a WEB page that will display a Jmol image and then have two sections along the side. In one section, the user can enter full HTML text into a form field, including Jmol.js calls (such as 'jmolButton'). The other panel can then load the code from the form field into the .innerHTML of the second section (a DIV). The goal is to let people test out code snippets before moving them into their final HTML files.

The transfer from the form field to the DIV.innerHTML is working well and code such as <b>dog</b> correctly displays the word 'dog' in bold. All HTML code is properly interpreted. However, when I include <script>jmolButton(..,..)</script>, everything from the opening script tag to the closing script tag is simply ignored. Other HTML code past that point displays correctly.

I'm guessing that I may be trying to do something that browsers don't allow - a security issue perhaps? Does anyone have any workarounds?


The solution is made possible by the genius and insight of the Jmol developers. I process the text, pulling things within <SCRIPT> tags and then use the "eval" function in Javascript. I have been using Jmol.js in the write directly to document mode, but just before "eval" I set jmolSetDocument(false) (and then reset it on).

It's working great now. Thanks to the foresight of all of the Jmol developers!

   To see what I have so far and test it out, go to:

       <http://people.chem.umass.edu/cmartin/Jmol/WingedHelixII>

Then click on 'Cmd' at the top and look down to 'Test Bed' and 'Preview'

This allows authors of presentations to test out their HTML code in real time, without having to refresh the browser window. This aspect, I suspect, may be of more general interest. I welcome comments.

Thanks,

Craig Martin
[EMAIL PROTECTED]



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to