Tip -- Defining & Using A Variable

This tip demonstrates a unique way to use the META REFRESH tag to define a variable which other objects can read or write.


Figure 1.

Step 1
Define a variable by creating a META REFRESH tag to store data in. The example in Figure 1 (" TempVar.htm" ) uses the following META  REFRESH tag to create a variable with the name MetaOne:

< META HTTP-EQUIV=" REFRESH" CONTENT=" 0 URL=Amulet:NOP() NAME=MetaOne VALUE=0" >

It is not required to define an initial value, but this example does by setting VALUE to 0.

Step 2
Now that variable MetaOne is defined, it's time to read and write to the variable. " TempVar.htm" uses two Amulet widgets to read and write to MetaOne. To read the value stored in MetaOne, the ImageBar widget uses the following href value:

< PARAM NAME=" href" VALUE= " Amulet:document.MetaOne.byteValue()" >

The ImageBar widget uses the value returned by MetaOne to know what percentages of the full and empty images to display. In order to write a value to MetaOne, the Slider widget uses the following href value:

< PARAM NAME=" href" VALUE= " Amulet:document.MetaOne.setByteValue()" >

Each time the handle on the Slider widget is moved, the widget writes a corresponding value to MetaOne.

Step 3
Now save, compile, and program " TempVar.htm" into the Amulet Module. Upon programming the Amulet Module, play with the slider to see that there really is a variable resident in the module which holds data from the Slider widget.

Download this Demo
  TempVarTip.zip
  Last Updated: July 11, 2002

Amulet Tip Archive
Amulet Tips


© 2003-2005 Amulet Technologies. U.S. and Foreign Patents Pending.
µ HTML is a Trademark of Amulet Technologies