x: focal length: chose "spherical" to show aberrations:
id1 = document.Opticspplet.addObject("mirror","x=2.5,f=1");
As a side effect, "id1" will appear in all drop down menus for parameters that demand objects, e.g. to create " ...setDragable(id1,true)".
The default script that is displayed at start up of PhysletBuilder corresponds to a function init(), that is executed at start up of the final physlet page. You may add further scripts that will be associated with push buttons at the physlet page. If you rename or delete the init script, the physlet won't perform any action without pushing a script button.
Script: Rename: Delete New
If you want your students to enter data on the physlet page, you can provide input fields for them. They should carry default values to avoid errors if the script is executed before a student enters a value. For your script, you can use as variables all the names of input fields that appear in the drop down menu "Input:" at a given moment as though they were defined beforehand in the script.
Input: Rename: Default: Delete New
Caution is needed if you want to use variables for parameters that appear enclosed within quotation marks. In this case, you'll have to break the respective string for the variable. For example, in order to use input fields f or xpos in addObject("mirror","x=2.5,f=1")change the script manually to:
id1 = document.Opticspplet.addObject("mirror","x=2.5,f="+f);
(PhysletBuilder is tested with InternetExplorer 5.5, an may not be supported by other browsers - feed back is welcome, see below)
|"Save As" in browser menu "file" doesn't work with Applet preview:||Save html source code, either by right clicking at the white background of physlet preview (if "on") - or by selecting physlet preview "html" in PhysletBuilder and copy-paste source code from pop-up window to external text editor and save there.|
|object parameters display "n/a yet" instead of input fields||First, you need to insert an object that introduces a variable for its ID in the script. This yields lines starting with "id...=...". Then, every such variable will be available in drop down menues for parameters that expect object IDs.|
Feed-back to: Frank Schweickert, University of Kaiserslautern, Germany