Hello!
I have two tables. Each displays a make believe Bible verse in the King James
Version. Using a select list (there is one for each verse) the user can choose
to display either verse in the New American Standard version instead. The
comments between the <!-- --> (just above the tables) explain the specific
problem I'm having. Any help is appreciated.
var Verse1KingJames = new String( "Thy will be done. (KJV)" );
var Verse1NewAmericanStandard = new String( "Your will be done. (NASB)" );
var Verse2KingJames = new String( "Thou shalt not... (KJV)" );
var Verse2NewAmericanStandard = new String( "You are not to... (NASB)" );
function HandleVersionChange( theBibleVerse )
{
//If the user made a change in the first verse's select list, whichBibleVerse
will contain the value "BibleVerse1."
whichBibleVerse = new String( "Bible" + theBibleVerse );
//Assuming the user selected NASB, theSelectedTranslation will contain the
value "0."
theSelectedTranslation = document.getElementById( whichBibleVerse
).selectedIndex;
//theTranslationAbbreviation will contain the value "NewAmericanStandard."
if ( theSelectedTranslation == 0 )
{
theTranslationAbbreviation = new String( "KingJames" );
}
if ( theSelectedTranslation == 1 )
{
theTranslationAbbreviation = new String( "NewAmericanStandard" );
}
//theStringToDisplay will contain the value "Verse1NewAmericanStandard."
theStringToDisplay = new String( theBibleVerse + theTranslationAbbreviation );
//At this point, the first verse should change to display the New American
Standard version of the verse rather than the King James Version. Instead, the
text displayed is "Verse1NewAmericanStandard" rather than "Your will be done.
(NASB)." How do I correct this?
document.getElementById( theBibleVerse ).innerHTML = theStringToDisplay;
}
<!-- These are the HTML tables (I'm only showing the bare necessities.). The
original text displays properly. When the user selects the NASB option from the
select list, HandleVersionChange() is called. It determines which verse needs
to be re-displayed and with what translation. The last line in that function
(the one that actually displays the change) is the one giving me trouble. -->
<table>
<tr>
<td>
<select class = "bibleTranslation" id = "BibleVerse1" onchange =
"HandleVersionChange( 'Verse1' );">
<option selected="selected">KJV</option>
<option>NASB</option>
</select>
</td>
<td>
<div id = "Verse1">Thy will be done. (KJV)</div>
</td>
<td>Genesis ?:?</td>
</tr>
</table>
<table>
<tr>
<td>
<select class = "bibleTranslation" id = "BibleVerse2" onchange =
"HandleVersionChange( 'Verse2' );">
<option selected="selected">KJV</option>
<option>NASB</option>
</select>
</td>
<td>
<div id = "Verse2">Thou shalt not... (KJV)</div>
</td>
<td>Matthew ?:?</td>
</tr>
</table>
Thanks,
Jim