scm0sml
asked on
removing a substring froma string.
I have the following function.
The section I am interested in is:
strCabinIDs = strCabinIDs - ("**" & cabinid);
I know this isnt correct. What I'm trying to do is remove the cabinid that is passed in from the string strcabinids.
If there is a ** preceding the id then i need to remove that as well.
Any ideas?
The section I am interested in is:
strCabinIDs = strCabinIDs - ("**" & cabinid);
I know this isnt correct. What I'm trying to do is remove the cabinid that is passed in from the string strcabinids.
If there is a ** preceding the id then i need to remove that as well.
Any ideas?
var strCabinIDs
strCabinIDs = "";
function CheckCabinQuota(cabinCheckbox,cabinid)
{
alert(strCabinIDs);
if(cabinCheckbox.checked == false)//if the user has deselected a cabin
{
form1.CurrentCabinCount.value = parseInt(form1.CurrentCabinCount.value) - 1;
strCabinIDs = strCabinIDs - ("**" & cabinid);// the ** is added to give us something distinctive to split the string on when returning id's
}
else//else they are trying to selelct another cabin
{
if (form1.AllowedCabinCount.value > form1.CurrentCabinCount.value)//if they have not selected all required cabins
{
form1.CurrentCabinCount.value = parseInt(form1.CurrentCabinCount.value) + 1;
strCabinIDs = strCabinIDs + cabinid + "**";// the ** is added to agive us something distinctive to split the string on when returning id's
}
else
{
alert("You have selected more cabins than required. You must de-select one of your previous choice's before being able to select another.");
cabinCheckbox.checked = false; //and de-select the choice they have just made.
}
}
alert(strCabinIDs);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
strCabinIDs = strCabinIDs.replace(cabini