Jmol JavaScript Object/Legacy/Applet Tags

From Jmol
Jump to navigation Jump to search

Legacy syntax for embedding Jmol into web pages as Java applets

This was the first method (approx. up to 2006) for including Jmol Java applets, as well as the control buttons that allowed to script actions on the model displayed in the Jmol panel.

This is collated here for historical interest.

A small JavaScript library has been prepared to automate conversion of these tags to modern JSmol syntax. Read about this.

Jmol panels

Example:

<applet code="JmolApplet" name="panelA"
  width="300" height="250" 
  archive="JmolApplet.jar" mayscript="true">
 <param name="progressbar" value="true" />
 <param name="progresscolor" value="blue" />
 <param name="boxmessage" value="Downloading JmolApplet.jar" />
 <param name="boxbgcolor" value="black" />
 <param name="boxfgcolor" value="white" />
 <param name="load" value="caffeine.mol" />
 <param name="script" value="select all; labels off; spacefill 0.25; wireframe 0.1; center atomno=2" />
</applet>

Push buttons that apply a script

Example:

<applet code="JmolAppletControl"
  width="80" height="20"
  archive="JmolApplet.jar" mayscript="true">
 <param name="type" value="button" />
 <param name="label" value="Stop spinning" />
 <param name="target" value="panelA" />
 <param name="script" value="spin off" />
</applet>

Toggle buttons that apply two alternative scripts

Example:

<applet code="JmolAppletControl"
  width="12" height="12" 
  archive="JmolApplet.jar" mayscript="true">
 <param name="type" value="chimeToggle" />
 <param name="target" value="panelA" />
 <param name="script" value="select atomno=2,atomno=3,atomno=5; color atom yellow; spacefill 120; wireframe 40" />
 <param name="altscript" value="select atomno=2,atomno=3,atomno=5; color atom cpk; spacefill 10; wireframe 25" />
</applet>

Contributors

AngelHerraez