Page 6: Using Script Files with Embedded Control Elements

[Home] [Page 1] [Page 2] [Page 3] [Page 4] [Page 5] [Page 6] [Page 7]


Script Files

There are two ways that control elements can be used to send Rasmol script commands to a Jmol image:


  • The first way is the one we have been using, which places the Rasmol script commands, separated by semicolons, directing in the JavaScript function argument for the control element. Below is an example:

For this button, the Rasmol script commands are included in the script argument for the jmolButton control elements

Below is what the jmolButton script for this button looks like in the JavaScript Editor window:


  • A second way is to place the Rasmol script commands in a separate text file and to have the Jmol control element call the text file using the Rasmol "script" script command:

For this button, the Rasmol script commands are placed in a separate text file named "scriptA.txt", which is located in the directory "Page6_Media"

Below is what the jmolButton script for this button looks like in the JavaScript Editor window:


The advantage of the second method is that when a script for a control element has multiple commands, it is easier to to edit them in a separate text file, where each command can be placed on a different line. GoLive has a built-in simple text editor that can be used to create and edit the script files. Below is a picture of the text editor window showing the script used for the button used to demonstrate the second method.

Also, when editing a script, this file can be left opened, edited, saved and tested in a browser, without having to reedit the web page that contains the control element.


[Home] [Page 1] [Page 2] [Page 3] [Page 4] [Page 5] [Page 6] [Page 7]