473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Trouble with Strings

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
Jul 20 '05 #1
2 1305

"BrassWorld" <br********@aol.com> schreef in bericht
news:20***************************@mb-m28.aol.com...

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)" );
You don' t have to use the String object to create a new string, a simple:

var Verse1KingJames = "Thy will be done. (KJV)";

will do.
//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;
}


document.getElementById(theBibleVerse).innerHTML =
window[theStringToDisplay];
JW

Jul 20 '05 #2
Thanks!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: Erlend Fuglum | last post by:
Hi everyone, I'm having some trouble sorting lists. I suspect this might have something to do with locale settings and/or character encoding/unicode. Consider the following example, text...
4
by: Guilherme Salgado | last post by:
Hi there, I have a python source file encoded in unicode(utf-8) with some iso8859-1 strings. I've encoded this file as utf-8 in the hope that python will understand these strings as unicode...
6
by: DJ | last post by:
I am currently having trouble with strings. I have a private string variable in my class and i assign a value to it in the creation function as follows. #include <string> using std::string; ...
3
by: Aaron Walker | last post by:
I have a feeling this going to end up being something so stupid, but right now I'm confused as hell. I'm trying to code a function, that given a string and a delimiter char, returns a vector of...
22
by: stoppal | last post by:
need to extract all text between the following strings, but not include the strings. "<!-- #BeginEditable "Title name" -->" "<p align="center">#### </p>" I am using preg_match(????, $s,...
11
by: KraftDiner | last post by:
This is not working the way I think it should.... it would appear that fromfile and getName are calling the baseClass methods which are simple passes.... What have I done wrong? class...
1
by: yucikala | last post by:
Hello, I'm a "expert of beginner" in C#. I have a dll - in C. And in this dll is this struct: typedef struct msg_s { /* please make duplicates of strings before next call to emi_read() ! */ ...
5
by: Henaro | last post by:
Hello~ I am having trouble setting environment variables in C++ on win32. The code that is not working is: char prxy; char pf_cmd1 = "set http_proxy="; ....
8
by: merrittr | last post by:
I define 2 variables (that I need to be globally accesible in all files in this program) in the file stack.c (functions push and pop): //stack.c defnition if params int iSp=0; char *iItem; ...
2
by: marcf | last post by:
Hello Everyone! I have so nearly finished a mud client for a customer to the point where I was about to send them the source code. Out of luck I took the project home to try it on my personal PC...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.