JavaScripTools Manual


Retrieving and setting values on form fields and html elements

The getValue and setValue functions are used to retrieve and set values on both form fields or html elements (using the innerHTML property). The behaviour depends on the object type:

//Assume a div named dv, a text named txt and a set of checkboxes named chk, whith values "1", "2" and "3"
setValue("txt", "ABC") -> Sets the input value
getValue("txt") -> "ABC"
setValue("dv", "The new value") -> Sets the div innerHTML property
setValue("chk", ["1", "2"]) -> checks the checkboxes with value = 1 and 2

There is also the checkAll function, that checks or unchecks all checkboxes with a given name.

//Assume a set of checkboxes named chk
checkAll("chk") -> Check all
checkAll("chk", false) -> Uncheck all

Working with dates
Table of Contents Next:
Manipulating options on a select box