key.settings.callback

getKey(id).settings.callback( command ) or getKey(id).settings.callback( command1, command2 ) Will execute the command(s) whenever a key corresponding to the element is pressed. Example: [js highlight=”7-17″ try=”true”]newText(“sentence”, “Hello world”) .print() , newVar(“word”, 0) , newKey(“control”, ” \n\r”) .settings.callback( getText(“sentence”) .settings.color(“red”) , newTimer(1000) .start() .wait() , getText(“sentence”) .settings.color(“black”) )[/js] Prints Hello world onto the page and will highlight …

button.settings.callback

getButton(id).settings.callback( command ) or getButton(id).settings.callback( command1, command2 ) Will execute the command(s) whenever the button is clicked. Example: [js highlight=”5-9″ try=”true”]newVideo(“skate”, “skate.mp4”) .print() , newButton(“(Re)play”) .settings.callback( getVideo(“skate”) .stop() .play() ) .print()[/js] Adds onto the page a video and a button which, whenever clicked, starts or restarts playing the video from the beginning.

dropdown.settings.log

getDropDown(id).settings.log() or getDropDown(id).settings.log(“first”) or getDropDown(id).settings.log(“all”) Will add a line to the results file for the current trial reporting what option was selected. If you pass “first” as the argument, it will report the option selected upon first selection, ignoring further selections. If you pass “all” as the argument, it will add a line for each …

dropdown.test.selected

getDropDown(id).test.selected(option) or getDropDown(id).test.selected() Tests whether an option is selected. If you pass no option as an argument, then the test will succeed as long as any option is selected. If you pass a number, and provided there is no option whose text content corresponds to this exact number, it will test the index of the …

dropdown.settings.remove

getDropDown(id).settings.remove(“option”) Removes a single option from the list. Nothing happens if the option passed as an argument is in fact not in the list. Example: [js highlight=”17,18″ try=”true”]newDropDown(“value” , “Truth value”) .settings.add( “True” , “False” ) .print() , newScale(“logic”, “Binary”,”Three-valued”) .settings.default(“Binary”) .settings.before( newText(“Logic: “) ) .settings.labelsPosition(“right”) .settings.callback( getScale(“logic”) .test.selected(“Three-valued”) .success( getDropDown(“value”) .settings.add(“Other”) ) .failure( getDropDown(“value”) …

dropdown.settings.add

getDropDown(id).settings.add(“option”) or getDropDown(id).settings.add(“option1″,”option2″,…) Adds an option, or several options to the drop-down list. Example: [js highlight=”2″ try=”true”]newDropDown(“language” , “First language”) .settings.add( “English” , “French” , “Tagalog” ) .print() [/js] Creates a drop-down list with default text First language and adds three options to it: English, French and Tagalog, then prints the list onto the page.

dropdown.wait

getDropDown(id).wait() or getDropDown(id).wait(“first”) or getDropDown(id).wait(test) Waits until an option is selected from the drop-down list before proceeding. If you call wait(“first”), then if an option has already been selected by the time this command is evaluated, the next commands are evaluated and executed right away. If no option has been selected so far, the next …

dropdown.select

getDropDown(id).select( “option” ) Selects an option in the drop-down list. Nothing happens if the option passed as an argument does not exist. Example: [js highlight=”3″ try=”true”]newDropDown(“warmth”, “”) .settings.add(“hot”, “lukewarm”, “cold”) .select( “lukewarm” ) , newText(“Spring in Colorado is  “) .settings.after( getDropDown(“warmth”) ) .print()[/js] Creates a drop-down list containing the options hot, lukewarm and cold, selects …

dropdown.shuffle

getDropDown(id).shuffle() or getDropDown(id).shuffle( “keep selected” ) Shuffles the options that have been added to the DropDown so far. If you call shuffle before settings.add then it will have no effect. Passing an argument means that you want any option currently selected to remain selected after the shuffle (“keep selected” is simply given as an example—you …