<script>
<!---- Hide script from old browsers
// Wagner lyric quiz
// written by Stephen Battey - March 1997
// http://www.oocities.org/Heartland/Plains/5287
// Modified in April 1997 by Stephen Battey
// Addition of select object for lyric number
// Set global variables to hold text that has
// been entered or text to be displayed.
ResponseText = new Array (" ...TRY AGAIN...", " ...HAVE ANOTHER GO...",
" ...NOPE !" , " ...WRONG !" , " ...GIVE IN ?")
AnswerArray = new Array ("BOHEMIAN RHAPSODY", "LIVIN ON A PRAYER",
"THE BOXER" , "BORN TO BE WILD" ,
"WANABE" , "ITS A SIN" )
DisplayArray = new Array ("Bohemian Rhapsody by Queen" , "Livin\' On A Prayer by Bon Jovi",
"The Boxer by Simon & Garfunkel", "Born To Be Wild by Steppenwolf" ,
"Wannabe by Spice Girls" , "It\'s A Sin by Pet Shop Boys" )
ReplyText = new Array ("", "", "", "", "", "")
GuessText = new Array ("", "", "", "", "", "")
NoOfTrys = new Array (0 , 0 , 0 , 0 , 0 , 0 )
CurLyric = 0
function NextLyric (formName) {
// Procedure to set-up text fields and
// global variables when user selects a
// different lyric to guess at
// Place current values into stores array
ReplyText[CurLyric] = formName.reply.value
GuessText[CurLyric] = formName.guess.value
// Get new selected lyric number
CurLyric = formName.lyricno.selectedIndex
// Restore text values from arrays
formName.reply.value = ReplyText[CurLyric]
formName.guess.value = GuessText[CurLyric]
}
function Reply(formName) {
// Procedure to test an entry and act on
// the correct/incorrect answer.
if ( formName.guess.value!="" ) {
if ( CorrectAns(formName.guess.value) ) {
DisplayAns(formName)
formName.guess.value=" CORRECT !!"
} else {
Wrong(formName)
}
}
}
function DisplayAns (formName) {
// Show answer when trial is correct
// or user has 'Give in'
formName.reply.value = DisplayArray[CurLyric]
formName.guess.focus()
}
function Wrong(formName) {
// Procedure to handle an incorrect entry
formName.reply.value = ResponseText[NoOfTrys[CurLyric]]
NoOfTrys[CurLyric]++
if ( NoOfTrys[CurLyric]==5 )
NoOfTrys[CurLyric]=4
formName.guess.focus()
}
function CorrectAns(got) {
// Returns true if the users guess contains the correct answer
// Single addition or missing character should be ignored/accepted
want = AnswerArray[CurLyric]
got = got.toUpperCase()
for (i=got.length; i
</script>