TQS Home
Trivia Quiz Shell Version 2.8 Now Available!Bot Productions Home
 
TQS 2.0

Back to Reference

SCRIPT Element

Specifies JavaScript that contains functions and variables that implement the custom location type.

Syntax
<SCRIPT>
  ...
</SCRIPT>
Attributes

None.

Placement

The SCRIPT element must be a child of the CUSTOMDIV element.

Children

No children are supported within the SCRIPT element.

Remarks

Script within this element and the ONLOAD element may use the script variables and functions described in the reference.

TQS 2.7 and earlier All variables, functions, and any other identifiers must begin with "S_". In multiple custom location types, you can use the same variable, S_foo, but they will not be the same; each location type's variables are specific to it. This is not required as of TQS 2.8; TQS will automatically manage the separation of location types' identifiers.

Applications marked to require TQS 2.1 can use the variable dataRoot within the script to refer to the data root path. Version 2.5 and newer applications should use the getDynVal function.

The script contents must use &gt; and &lt; instead of > and <, respectively.

Only JavaScript may be used.

Example

This sample shows some of the basics of how to use a custom script.

<SCRIPT>
  var numCorrect = 0;
  var numWrong = 0;
  var curQuestion = 0;
  var questionsUsed = new Array();
  // more variables as needed

  function loadFirstQuestion()
  {
    numQuestionsSpan.innerText =
      "Number of questions: " +
      xmlNumChildOf(xmlLocData, "QUEST");

    // remainder of implementation
  }

  function loadQuestion()
  {
    imgEl.src = getDynVal("DATAROOT")+"img.gif";
    // remainder of implementation
  }

  function handleMouseEvent(evt)
  {
    switch(evt)
    {
      // handle different events
    }
  }
  
  // more functions as needed
</SCRIPT>


©2016 Bot Productions. All rights reserved.Last Updated: June 14, 2001