The following variables can be placed in the HTML of any custom item. MediaLab will substitute the appropriate values in the HTML code before it is displayed. This is a convenient way to substitute information from the current MediaLab item without having to alter the HTML code. Such substitutions could include color and font information, response options, question wording, background images, parameters, and so forth.
Note that you can also substitute calculated values from a responses.xls file by placing the variable name in angular brackets. For example, if you had a calculated value named "total" in your responses.xls file, you could enter <total> in your HTML file and MediaLab would substitute the correct value at the time the HTML is displayed.
All of the variables above may be directly substituted into your HTML file. For example, if the question wording in you HTML were: "Please choose from one of the <ml.p> alternatives" and you had used the parameter (p5), the question wording would appear as "Please choose from one of the 5 alternatives."
The code to display an image in HTML may look like this:
Instead of having this be a fixed image, you could have your custom item pull up a different picture every time by placing an image in the background field in the questionnaire. Then, in your HTML you could specify:
Voila--a different picture every time--whatever you have put in the BackGround field!
Indirect Substitution (optional)
Values may be directly substituted by entering them directly into the HTML code as above. This can make previewing the HTML (e.e., in Internet Explorer) a little difficult because IE won't know what <ml.bg> means. If you don't care about previewing the HTML, then it doesn't really matter. However, there is an alternative method called indirect substitution where you can list the substitutions below all the HTML code like this: