playSound FunctionPlays the sound associated with a correct or an incorrect answer. SyntaxplaySound(id); Parameters
ReturnsThere is no return value. RemarksThe sound files associated with correct and incorrect answers are taken from the SOUND attribute of the CORRECT and INCORRECT elements. These elements must exist either within the global settings HTML or CUSTOM_* element, or directly within global settings, in order to be used by this function. In order for any sounds to be played, the TQS element's USESSOUNDS element must be set to "1". Use the playSoundFile function to play a specific sound file. Example 1<LOC ID="3" TYPE="CUSTOM_FOO"> <CORRECT SOUND="correct.wav"/> <INCORRECT SOUND="incorrect.wav"/> <CUSTOM_FOO> ... </CUSTOM_FOO> </LOC> <CUSTOMDIV NAME="CUSTOM_FOO"> ... <SCRIPT> ... if(answerCorrect) playSound(0); else playSound(1); ... </SCRIPT> </CUSTOMDIV> Example 2<GLOBAL> <CORRECT SOUND="correct.wav"/> <INCORRECT SOUND="incorrect.wav"/> ... </GLOBAL> <LOC TYPE="HTML"> ... <HTML> ... <BUTTON ID="correct" ONCLICK="playSound(0);"/> <BUTTON ID="incorrect" ONCLICK="playSound(1);"/> ... </HTML> </LOC> |