We found that when we delete the line "jmolSetDocument(0)" in your
jmollayout.js, the applet loads fine and shows the structures. However, now
it displays "undefined undefined undefined" under the buttons; any
suggestion why this is happening?
Sudeep
On 11/28/05 12:07 PM, "Bob Hanson" <[EMAIL PROTECTED]> wrote:
> Sudeep,
>
> I think what you are after is a general .js file that you can add in a
> <script> tag to add general functionality. Here's what I recommend:
>
> Use the new Jmol.js functionality
>
> jmolSetDocument(0)
>
> What this does is turn off the automatic writing of the applet code to
> the page as the page loads. Now, you could build your own little
> function, such as:
>
> isinitialized=0 //necessary if more than one applet is to be written
>
> function myLayout(filename){
> if(!isinitialized)jmolInitialize("..")
> isinitialized=1
> jmolSetDocument(0)
> var sappcode=jmolApplet(300,"load "+filename)
> var sbutton1=jmolButton(
> "select *;spacefill on;wireframe off","spacefill")
> var sbutton2=jmolButton(
> "select *;wireframe on;spacefill off","wireframe")
>
> var sout="<table><tr><td>"+sappcode+"</td></tr>"
> +"<tr><td>"+sbutton1+" "+sbutton2+"</td></tr></table>"
>
> document.write(sout)
> }
>
> That sort of thing. You would put this function in a jmollayout.js
> file and add it to any page like you do Jmol.js. You could make it as
> flexible as you need to. Then, where you might have put
>
>
> <script type="text/javascript">
> jmolInitialize()
> jmolApplet(...)
> ....
> </script>
>
>
> Just insert something like:
>
> <script type="text/javascript">myLayout("myfile.pdb")</script>
>
> Is that what you are after? I've put up a simple example as
>
> http://www.stolaf.edu/people/hansonr/jmol/docs/examples/layout.htm
> http://www.stolaf.edu/people/hansonr/jmol/docs/examples/jmollayout.js
>
> Bob Hanson
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users