[Jmol-users] Developing a Jmol test bed

2007-11-18 Thread Craig T Martin

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 dog correctly displays the word 'dog'  
in bold. All HTML code is properly interpreted. However, when I  
include jmolButton(..,..), 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 

Re: [Jmol-users] Developing a Jmol test bed

2007-11-17 Thread Bob Hanson
Craig, you simply first invoke

jmolSetDocument(0);

then when you get that button code, you do it this way:


document.getElement("whatever").innerHTML = jmolButton()

That is, Jmol.js then returns the code rather than doing a 
document.write(), and you send it to the div.

Bob

Craig T Martin wrote:

> Greetings,
>
> 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 dog correctly displays the word 'dog' in 
> bold. All HTML code is properly interpreted. However, when I include 
> jmolButton(..,..), 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?
>
>To see what I have so far and test it out, go to:
>
>
>   Then click on 'Cmd' at the top and look down to 'Test Bed' and 'Preview'
>
> 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/vse012070mrt/direct/01/
>
>
>
>___
>Jmol-users mailing list
>Jmol-users@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>  
>


-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get. 

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900



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


Re: [Jmol-users] Developing a Jmol test bed

2007-11-17 Thread Angel Herraez
Another idea:
use ONLY jmolScript()
I've done a quick test and this seems to work, as no form controls are being 
built on the fly.

e.g. instead of
jmolButton(.a.,.b.)
use


I think this confirms my former suggestion: Jmol.js functions that build 
controls while page is loading cannot be applied to your current setup.

I still think the solution may be in using
http://jmol.sourceforge.net/jslibrary/index.en.html#jmolSetDocument
whre it says explicitly "...which can later be used to write a page or to write 
into a div, using JavaScript."

Yes! It works, but only when the input field contains just the Jmol.js 
function:


jmolInitialize("./")
jmolApplet("300", "load lysozyme.pdb")
jmolSetDocument(false)







Hope with these hints you can make up a way to have all you need 
working.


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


Re: [Jmol-users] Developing a Jmol test bed

2007-11-17 Thread Angel Herraez
Hi Craig

A very interesting utility!

I'm guessing, but I think your problem is due to the factv that jmolButton() 
etc use the 
Jmol.js library, and this acts only when the page is being built/rendered.
Let me explain myself:
A call to jmolButton() adds HTML code while the page is loading, and so it 
generates the 
button (a form object) at page load time, which will call Jmol scripts later on 
upon user 
action. 
Since your method is writing on the fly to the already built and loaded page, 
any Jmol.js 
function will not work as the real working code will not get inserted into the 
page.

I'm not sure about any workaround. Maybe using an IFRAME instead of a DIV, so 
you can 
reload the page contained within. Maybe inserting the code that jmolButton 
would insert 
(copied form inside Jmol.js), instead of jmolButton() text itself. Maybe 
playing with 
jmolSetDocument(false)
Just guessing wildly, sorry


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


[Jmol-users] Developing a Jmol test bed

2007-11-17 Thread Craig T Martin

Greetings,

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 dog correctly displays the word 'dog' in  
bold. All HTML code is properly interpreted. However, when I include  
jmolButton(..,..), 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?


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

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


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/vse012070mrt/direct/01/___
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users